Skip to content

fix: close connect modal after social login completes#599

Merged
Agilulfo1820 merged 2 commits intomainfrom
claude/fix-social-login-modal-3JIX0
Mar 10, 2026
Merged

fix: close connect modal after social login completes#599
Agilulfo1820 merged 2 commits intomainfrom
claude/fix-social-login-modal-3JIX0

Conversation

@Agilulfo1820
Copy link
Copy Markdown
Member

@Agilulfo1820 Agilulfo1820 commented Mar 9, 2026

Move auto-close logic from MainContent to ConnectModal so it runs
regardless of which content view is displayed. Previously, when a
social login button was clicked, the modal switched to LoadingContent
which unmounted MainContent and its auto-close effect, causing the
modal to stay open even after successful authentication.

https://claude.ai/code/session_013M6uC6KCxFt8kV7ccu9EEZ

Summary by CodeRabbit

  • New Features
    • Connect modal now automatically closes when a wallet is successfully connected.
  • Chores
    • Package version bumped (2.6.3 → 2.6.4).

Move auto-close logic from MainContent to ConnectModal so it runs
regardless of which content view is displayed. Previously, when a
social login button was clicked, the modal switched to LoadingContent
which unmounted MainContent and its auto-close effect, causing the
modal to stay open even after successful authentication.

https://claude.ai/code/session_013M6uC6KCxFt8kV7ccu9EEZ
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

Moved wallet-connection monitoring and auto-close behavior from MainContent into the parent ConnectModal; MainContent no longer accepts onClose or preventAutoClose. Package version bumped from 2.6.3 to 2.6.4.

Changes

Cohort / File(s) Summary
ConnectModal Auto-Close
packages/vechain-kit/src/components/ConnectModal/ConnectModal.tsx
Added useWallet import and a useEffect that auto-closes when connection.isConnected becomes true and modal is open; removed passing onClose/preventAutoClose to child.
MainContent API Simplification
packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx
Removed useWallet usage, removed onClose and preventAutoClose props from Props and component signature; deleted auto-close side effect.
Package Version Bump
packages/vechain-kit/package.json
Version increment from 2.6.3 to 2.6.4 (no code changes).

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant CM as ConnectModal
  participant MC as MainContent
  participant W as WalletHook
  rect rgba(135,206,250,0.5)
    U->>CM: open modal
    CM->>MC: render MainContent
  end
  rect rgba(144,238,144,0.5)
    W-->>CM: connection.isConnected = true
    CM->>CM: useEffect detects connection
    CM->>U: onClose() (modal closes)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly Related PRs

  • Feat/bottomsheet #555: Changes the same ConnectModal/MainContent area and addresses preventAutoClose and connection-driven modal behavior.

Suggested Reviewers

  • mikeredmond
  • victorkl400

Poem

🐰 I hopped from child to parent, light and spry,
The modal listens now, no extra cry,
Props tucked away beneath the hill,
A tidy flow, quiet and still,
Hooray — I nibble code by moonlit sky!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: moving auto-close logic to ConnectModal to ensure the modal closes after social login completes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-social-login-modal-3JIX0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx (1)

20-27: ⚠️ Potential issue | 🟠 Major

Remove the dead onClose prop from MainContent.

onClose is no longer used after moving the auto-close effect into ConnectModal, and ESLint is already flagging this at Line 27. Drop it from Props and from the ConnectModal call sites so this refactor doesn't leave a lint-blocking error behind.

✂️ Proposed cleanup
 type Props = {
     setCurrentContent: React.Dispatch<
         React.SetStateAction<ConnectModalContentsTypes>
     >;
-    onClose: () => void;
 };
 
-export const MainContent = ({ setCurrentContent, onClose }: Props) => {
+export const MainContent = ({ setCurrentContent }: Props) => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx`
around lines 20 - 27, Remove the unused onClose prop from the MainContent
component: update the Props type to drop onClose and change the MainContent
signature to only accept { setCurrentContent }: Props; then remove onClose from
every ConnectModal -> MainContent call site so callers no longer pass onClose
when rendering MainContent (search for MainContent and its JSX usages) and run
lint to ensure no remaining references remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx`:
- Around line 20-27: Remove the unused onClose prop from the MainContent
component: update the Props type to drop onClose and change the MainContent
signature to only accept { setCurrentContent }: Props; then remove onClose from
every ConnectModal -> MainContent call site so callers no longer pass onClose
when rendering MainContent (search for MainContent and its JSX usages) and run
lint to ensure no remaining references remain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f54ab0b3-725b-4c11-b8f8-4be43a429b0a

📥 Commits

Reviewing files that changed from the base of the PR and between dcacf4c and dd87fe2.

📒 Files selected for processing (2)
  • packages/vechain-kit/src/components/ConnectModal/ConnectModal.tsx
  • packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 9, 2026

Size Change: -511 B (-0.01%)

Total Size: 7.6 MB

Filename Size Change
packages/vechain-kit/dist/index-CvDATSTr.d.mts 0 B -152 kB (removed) 🏆
packages/vechain-kit/dist/index-CvDATSTr.d.mts.map 0 B -43.9 kB (removed) 🏆
packages/vechain-kit/dist/index-CWViOs1U.d.mts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-CWViOs1U.d.mts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index-DtaEPsFl.d.cts 0 B -152 kB (removed) 🏆
packages/vechain-kit/dist/index-DtaEPsFl.d.cts.map 0 B -43.9 kB (removed) 🏆
packages/vechain-kit/dist/index-I8fe7GR2.d.cts 0 B -5.63 kB (removed) 🏆
packages/vechain-kit/dist/index-I8fe7GR2.d.cts.map 0 B -2.99 kB (removed) 🏆
packages/vechain-kit/dist/index--hSO7Xv4.d.mts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index--hSO7Xv4.d.mts.map 2.99 kB +2.99 kB (new file) 🆕
packages/vechain-kit/dist/index-D0SCAGbu.d.mts 152 kB +152 kB (new file) 🆕
packages/vechain-kit/dist/index-D0SCAGbu.d.mts.map 43.9 kB +43.9 kB (new file) 🆕
packages/vechain-kit/dist/index-Duk_PiBp.d.cts 152 kB +152 kB (new file) 🆕
packages/vechain-kit/dist/index-Duk_PiBp.d.cts.map 43.9 kB +43.9 kB (new file) 🆕
packages/vechain-kit/dist/index-u3CPquCV.d.cts 5.63 kB +5.63 kB (new file) 🆕
packages/vechain-kit/dist/index-u3CPquCV.d.cts.map 2.99 kB +2.99 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
packages/vechain-kit/dist/assets 4.1 kB 0 B
packages/vechain-kit/dist/assets-BL24r-Yp.mjs 51.3 kB 0 B
packages/vechain-kit/dist/assets-BL24r-Yp.mjs.map 74.1 kB 0 B
packages/vechain-kit/dist/assets-DNJsQD7_.cjs 58.5 kB 0 B
packages/vechain-kit/dist/assets-DNJsQD7_.cjs.map 75.5 kB 0 B
packages/vechain-kit/dist/assets/index.cjs 716 B 0 B
packages/vechain-kit/dist/assets/index.d.cts 973 B 0 B
packages/vechain-kit/dist/assets/index.d.mts 973 B 0 B
packages/vechain-kit/dist/assets/index.mjs 718 B 0 B
packages/vechain-kit/dist/index.cjs 1.01 MB -97 B (-0.01%)
packages/vechain-kit/dist/index.cjs.map 2.38 MB -69 B (0%)
packages/vechain-kit/dist/index.d.cts 20.5 kB 0 B
packages/vechain-kit/dist/index.d.mts 20.5 kB 0 B
packages/vechain-kit/dist/index.mjs 976 kB -97 B (-0.01%)
packages/vechain-kit/dist/index.mjs.map 2.33 MB -69 B (0%)
packages/vechain-kit/dist/utils 4.1 kB 0 B
packages/vechain-kit/dist/utils-CzaSErgL.cjs 26.2 kB 0 B
packages/vechain-kit/dist/utils-CzaSErgL.cjs.map 65.1 kB 0 B
packages/vechain-kit/dist/utils-D6wgzl57.mjs 21 kB 0 B
packages/vechain-kit/dist/utils-D6wgzl57.mjs.map 64.4 kB 0 B
packages/vechain-kit/dist/utils/index.cjs 1.98 kB 0 B
packages/vechain-kit/dist/utils/index.d.cts 3.04 kB 0 B
packages/vechain-kit/dist/utils/index.d.mts 3.04 kB 0 B
packages/vechain-kit/dist/utils/index.mjs 2 kB 0 B

compressed-size-action

Clean up the unused onClose prop that remained after moving auto-close
logic to ConnectModal. Bump package version to 2.6.4.

https://claude.ai/code/session_013M6uC6KCxFt8kV7ccu9EEZ
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx (1)

20-26: Add a regression test for the loading-content handoff.

This fix depends on the modal still observing connection state after MainContent unmounts. A component test that switches into the social-login loading view and then asserts the modal closes on successful auth would help keep this from regressing.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx`
around lines 20 - 26, Add a regression test that mounts the ConnectModal and
verifies the modal still observes connection state after MainContent unmounts:
simulate user interaction that calls MainContent's setCurrentContent to switch
into the social-login loading view, then mock a successful auth/connection event
and assert the ConnectModal closes; the test should specifically target the
handoff from MainContent to the loading view (referencing MainContent and
setCurrentContent) and confirm the modal reacts to connection state changes even
after MainContent is unmounted to prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx`:
- Around line 20-26: Add a regression test that mounts the ConnectModal and
verifies the modal still observes connection state after MainContent unmounts:
simulate user interaction that calls MainContent's setCurrentContent to switch
into the social-login loading view, then mock a successful auth/connection event
and assert the ConnectModal closes; the test should specifically target the
handoff from MainContent to the loading view (referencing MainContent and
setCurrentContent) and confirm the modal reacts to connection state changes even
after MainContent is unmounted to prevent regressions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 863c06b5-da00-4b90-87b2-187b6bfd92aa

📥 Commits

Reviewing files that changed from the base of the PR and between dd87fe2 and 960bff5.

📒 Files selected for processing (3)
  • packages/vechain-kit/package.json
  • packages/vechain-kit/src/components/ConnectModal/ConnectModal.tsx
  • packages/vechain-kit/src/components/ConnectModal/Contents/MainContent.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/vechain-kit/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/vechain-kit/src/components/ConnectModal/ConnectModal.tsx

@Agilulfo1820 Agilulfo1820 merged commit 5e8e9c6 into main Mar 10, 2026
7 checks passed
@Agilulfo1820 Agilulfo1820 deleted the claude/fix-social-login-modal-3JIX0 branch March 10, 2026 08:54
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.

2 participants