Skip to content

fix: update profile after login during init#45

Merged
angeloashmore merged 2 commits intomainfrom
aa/fix-init-login-error-handling
Mar 11, 2026
Merged

fix: update profile after login during init#45
angeloashmore merged 2 commits intomainfrom
aa/fix-init-login-error-handling

Conversation

@angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Mar 11, 2026

Resolves:

Description

When init encounters an unauthenticated user, it triggers the login flow. After a successful login, the profile variable wasn't being updated with the new credentials, causing a failure when trying to look up the repository. This fix fetches the profile after login and only re-throws the error when login wasn't attempted.

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1


Note

Low Risk
Small control-flow change confined to the init/login error-handling path; primary risk is unexpected behavior if getToken()/getProfile() fail post-login.

Overview
Fixes prismic init when run while unauthenticated by re-fetching the auth token and calling getProfile() after createLoginSession() completes, ensuring repo membership validation uses the updated session.

Non-auth failures during the initial getProfile() call are now re-thrown immediately rather than being unconditionally thrown after the catch.

Written by Cursor Bugbot for commit 1670f8f. This will update automatically on new commits. Configure here.

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

angeloashmore and others added 2 commits March 10, 2026 16:20
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The token variable was not being refreshed after the login flow,
causing getProfile to use a stale/undefined token.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@angeloashmore angeloashmore marked this pull request as ready for review March 11, 2026 02:34
@angeloashmore angeloashmore merged commit ea38659 into main Mar 11, 2026
11 checks passed
@angeloashmore angeloashmore deleted the aa/fix-init-login-error-handling branch March 11, 2026 02:34
@cursor cursor bot mentioned this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant