fix: preserve page context via cookie after Bluesky redirect#930
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughClient components now capture the current route via 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/components/Header/AuthModal.client.vue (1)
26-36:⚠️ Potential issue | 🟠 MajorMissing
returnToparameter inhandleLogincreates inconsistent redirect behaviour.The
handleLogin()function for manual handle input does not include thereturnToquery parameter, whilsthandleBlueskySignIn()andhandleCreateAccount()do. Users logging in with a custom handle will be redirected to the homepage instead of their original page.🐛 Proposed fix to add returnTo parameter
async function handleLogin() { if (handleInput.value) { await navigateTo( { path: '/api/auth/atproto', - query: { handle: handleInput.value }, + query: { handle: handleInput.value, returnTo: route.fullPath }, }, { external: true }, ) } }
|
would you mind resolving the conflicts? 🙏 |
app/pages/package-docs/[...path].vue
Outdated
| /* Individual symbol articles */ | ||
| .docs-content .docs-symbol { | ||
| @apply mb-10 pb-10 border-b border-border/30 last:border-0; | ||
| word-break: break-word; |
There was a problem hiding this comment.
What does it have to do with the described fix?
There was a problem hiding this comment.
I was working on another issue and forgot to switch branches. Please ignore that commit for now
|
yeah, working on it |
wojtekmaj
left a comment
There was a problem hiding this comment.
Listen to the rabbit 🐰
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
wojtekmaj
left a comment
There was a problem hiding this comment.
Aside from the style change that sneaked in, LGTM.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/components/Header/AuthModal.client.vue (1)
29-33:⚠️ Potential issue | 🟠 MajorCustom handle login does not preserve page context.
The
handleLoginfunction usesauthRedirect(handleInput.value)without passing thereturnToparameter. Users who enter a custom handle will be redirected to the homepage after authentication, inconsistent with the other two login flows (handleBlueskySignInandhandleCreateAccount) which both passreturnTo: route.fullPath.The
authRedirectfunction currently accepts onlyidentifierand optionalcreateparameters, and does not includereturnToin its query object. Update the function signature to accept an optionalreturnToparameter:-export async function authRedirect(identifier: string, create: boolean = false) { +export async function authRedirect(identifier: string, create: boolean = false, returnTo?: string) { let query: LocationQueryRaw = { handle: identifier } if (create) { query = { ...query, create: 'true' } } + if (returnTo) { + query = { ...query, returnTo } + } await navigateTo( { path: '/api/auth/atproto', query, }, { external: true }, ) }Then call it with the return path in
handleLogin:async function handleLogin() { if (handleInput.value) { - await authRedirect(handleInput.value) + await authRedirect(handleInput.value, false, route.fullPath) } }
fatfingers23
left a comment
There was a problem hiding this comment.
LGTM! Thank you for adding it! Was a big ask we got
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/components/Header/AuthModal.client.vue (1)
17-21:⚠️ Potential issue | 🟡 MinorMissing
redirectToin manual handle login flow.The
handleLoginfunction does not passredirectTo: route.fullPath, unlike the other authentication flows. Users who log in by entering their handle manually will still be redirected to the homepage instead of their original page, which is inconsistent with the PR objective.Proposed fix
async function handleLogin() { if (handleInput.value) { - await authRedirect(handleInput.value) + await authRedirect(handleInput.value, { redirectTo: route.fullPath }) } }
fixes #901
Previously, users logging in via Bluesky were redirected to the homepage regardless of which page they started from.