Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Apr 4, 2025

Description

Summary

For custom flows

await setActive({ session })
const task = clerk.currentTask; 
mountTaskComponentIfAny(task)

Or use clerk.__experimental_nextTask for orchestrating navigation:

await setActive({ session })
await clerk.__experimental_nextTask({ redirectUrlComplete: afterTasksUrl })

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@LauraBeatris LauraBeatris self-assigned this Apr 4, 2025
@changeset-bot
Copy link

changeset-bot bot commented Apr 4, 2025

🦋 Changeset detected

Latest commit: 58c3bb1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Apr 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2025 5:01pm

@LauraBeatris LauraBeatris force-pushed the laura/after-auth-custom-flows-1 branch from 4c5822b to 21e089b Compare April 4, 2025 16:51
@LauraBeatris LauraBeatris changed the title chore(clerk-ks): Trigger navigation to tasks on setActive for internal routing only chore(clerk-js): Trigger navigation to tasks on setActive for internal routing only Apr 4, 2025
@LauraBeatris LauraBeatris requested a review from a team April 4, 2025 16:52
@LauraBeatris LauraBeatris force-pushed the laura/after-auth-custom-flows-1 branch from 21e089b to 58c3bb1 Compare April 4, 2025 16:52
@LauraBeatris LauraBeatris marked this pull request as ready for review April 4, 2025 16:52

if (newSession?.currentTask) {
// Only triggers navigation for internal routing, in order to not affect custom flows
if (newSession?.currentTask && this.#componentNavigationContext) {
Copy link
Member Author

@LauraBeatris LauraBeatris Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this explicitly means avoiding having to call nextTask on every single factor component.

For an actual application, with a single sign-in/sign-up form, it's just one method call. For our internal purposes, it would need to be replicated across multiple layers of the components after every setActive.

The whole reasoning of not triggering navigation to task once setActive detects a pending status, is the following:

  • Navigating without a explicit signature / param can be confusing
  • If a developer just wants to mount the task component on the same screen, after calling setActive, they should be able to do so

@LauraBeatris
Copy link
Member Author

Just noticed that one unit test is failing, which is expected tho, I'll fix it here!

CleanShot 2025-04-04 at 13 58 55

@LauraBeatris LauraBeatris merged commit 250b311 into main Apr 4, 2025
30 checks passed
@LauraBeatris LauraBeatris deleted the laura/after-auth-custom-flows-1 branch April 4, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants