Skip to content

Conversation

@panteliselef
Copy link
Member

@panteliselef panteliselef commented Feb 6, 2025

Description

Before (notice the brief flash of the page)

Screen.Recording.2025-02-06.at.6.33.06.PM.mov

After

Screen.Recording.2025-02-06.at.6.31.42.PM.mov

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:

@panteliselef panteliselef requested review from a team, brkalow and nikosdouvlis February 6, 2025 16:38
@panteliselef panteliselef self-assigned this Feb 6, 2025
@changeset-bot
Copy link

changeset-bot bot commented Feb 6, 2025

🦋 Changeset detected

Latest commit: f953513

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

This PR includes changesets to release 1 package
Name Type
@clerk/nextjs 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 Feb 6, 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 Feb 6, 2025 4:38pm

return useCallback((to: string) => {
return getClerkNavigationObject(name).fun(to);
return useCallback<NavigationFunction>((to, metadata) => {
return getClerkNavigationObject(name).fun(to, metadata);
Copy link
Member

Choose a reason for hiding this comment

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

mind sharing an instance of where we were passing the second argument metadata to push/replace? I want to look into why that wasn't causing a typescript error. useAwaitableReplace/useAwaitablePush should have only accepted a single argument.

Copy link
Member Author

@panteliselef panteliselef Feb 12, 2025

Choose a reason for hiding this comment

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

useAwaitableReplace/useAwaitablePush should have only accepted a single argument.

the hooks themselves do not take any arguments, previously they were returning a fuction that would accept a single argument, but in Clerk.navigate we are clearly passing 2 arguments.

Copy link
Member Author

Choose a reason for hiding this comment

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

it was not giving any typescript errors because the 2nd argument is optional

Copy link
Member

Choose a reason for hiding this comment

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

TypeScript is inferring the type as const useAwaitablePush: () => (to: string) => unknown though, so the returned function should be typed as only accepting a single argument. I guess we're losing that type safety somewhere along the way 🤔

Copy link
Member

Choose a reason for hiding this comment

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

ahhh okay clerk-js accepts that as RouterFn which has the optional metadata argument. Since the previous type was (to: string) => unknown, that satisfies (to: string, metadata?: whatever) => void.

@panteliselef panteliselef merged commit 6e67503 into main Feb 13, 2025
32 checks passed
@panteliselef panteliselef deleted the elef/sdki-859-fix-shallow-internal-component-navigation-in-nextjs branch February 13, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants