Update onboarding flow to support membership checks and BYOK#457
Update onboarding flow to support membership checks and BYOK#457baxen merged 2 commits intoblock:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 060403f8aa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onRetry, | ||
| pubkey, | ||
| }: MembershipDeniedProps) { | ||
| const npub = React.useMemo(() => pubkeyToNpub(pubkey), [pubkey]); |
There was a problem hiding this comment.
Guard npub conversion against missing pubkey
This component unconditionally calls pubkeyToNpub(pubkey), but OnboardingFlow explicitly sets deniedPubkey to an empty string when getIdentity() fails before routing here. In that error path, rendering MembershipDenied will throw during conversion and crash the onboarding screen instead of showing recovery actions. Handle invalid/empty pubkeys defensively (e.g., fallback text or conditional rendering) so membership-denied UX still works when identity lookup fails.
Useful? React with 👍 / 👎.
| await Promise.all([ | ||
| queryClient.invalidateQueries({ queryKey: ["identity"] }), | ||
| queryClient.invalidateQueries({ queryKey: profileQueryKey }), | ||
| ]); |
There was a problem hiding this comment.
Clear profile cache when importing a new identity
After key import, this only invalidates ['profile']; it does not remove old cached data. If the profile refetch for the new key fails (for example, imported key is not a relay member and profile reads return 403), React Query will keep serving the previous identity's profile data, so onboarding can show stale user info for the wrong identity. On identity switch, clear/reset the profile query data (not just invalidate) to avoid cross-identity leakage.
Useful? React with 👍 / 👎.
Summary
Testing