Skip to content

Update onboarding flow to support membership checks and BYOK#457

Merged
baxen merged 2 commits intoblock:mainfrom
baxen:baxen/membership-gate
May 4, 2026
Merged

Update onboarding flow to support membership checks and BYOK#457
baxen merged 2 commits intoblock:mainfrom
baxen:baxen/membership-gate

Conversation

@baxen
Copy link
Copy Markdown
Collaborator

@baxen baxen commented May 2, 2026

Summary

  • Update onboarding flow to support membership checks and BYOK

Testing

  • Not run (PR opened from existing fork branch)

@baxen baxen requested a review from wesbillman as a code owner May 2, 2026 23:33
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment on lines +361 to +364
await Promise.all([
queryClient.invalidateQueries({ queryKey: ["identity"] }),
queryClient.invalidateQueries({ queryKey: profileQueryKey }),
]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@baxen baxen enabled auto-merge (squash) May 4, 2026 19:39
@baxen baxen merged commit c1063a0 into block:main May 4, 2026
13 checks passed
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