Skip to content

Fixed exit button on Quiet Hobbies tab to clear parent#54

Open
adityasengarr wants to merge 1 commit intomainfrom
quiet-hobby
Open

Fixed exit button on Quiet Hobbies tab to clear parent#54
adityasengarr wants to merge 1 commit intomainfrom
quiet-hobby

Conversation

@adityasengarr
Copy link
Collaborator

@adityasengarr adityasengarr commented Dec 2, 2025

Before only set open to false, which closed the QuietHobbyModal and removed its overlay. But it never told the parent EventSelectionModal to close, so added onClose?.() to call the parent's close function, resets and removes all overlays.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced modal closure behavior to ensure proper synchronization with parent components, improving overall application responsiveness.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

Walkthrough

A callback invocation is added to the handleCloseModal function in the QuietHobbiesParticipant component to notify the parent component when the modal closes. The parent's optional onClose() is called immediately after setting the local open state to false.

Changes

Cohort / File(s) Summary
Modal close callback
rise-dc-app/src/scheduling_components/pages/QuietHobbiesParticipant.tsx
Adds invocation of parent's optional onClose() callback in handleCloseModal() to notify parent of modal closure

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Verify that the onClose prop is properly typed as optional
  • Confirm the callback is safely invoked (optional chaining or guard check in place)

Poem

🐰 A modal bids its parent goodbye,
With whispered words through closing skies,
No more secrets kept on the sly,
Communication's the rabbit's prize!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fixed exit button on Quiet Hobbies tab to clear parent' clearly and specifically describes the main change: enabling the exit button to properly notify the parent component when closing.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch quiet-hobby

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

@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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
rise-dc-app/src/scheduling_components/pages/QuietHobbiesParticipant.tsx (2)

36-50: Consider callback ordering consistency.

In handleChooseActivity (line 47), the parent callback is invoked before setOpen(false), but in handleCloseModal (lines 38-40), the local state is updated before calling onClose?.(). For consistency and to ensure the parent receives callbacks while the child's state is still "open," consider moving onClose?.() before setOpen(false).

Apply this diff for consistency:

 const handleCloseModal = () => {
   console.log("Closing modal, current open state:", open);
-  setOpen(false);
   // Properly calls the parent's onClose() which resets everything and removes all overlays.
   onClose?.();
+  setOpen(false);
 };

37-37: Consider removing debug logging.

The console.log statement appears to be debugging code. If this logging isn't needed for production troubleshooting, consider removing it.

Apply this diff to remove the console log:

 const handleCloseModal = () => {
-  console.log("Closing modal, current open state:", open);
   // Properly calls the parent's onClose() which resets everything and removes all overlays.
   onClose?.();
   setOpen(false);
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2c9369 and c82ec25.

📒 Files selected for processing (1)
  • rise-dc-app/src/scheduling_components/pages/QuietHobbiesParticipant.tsx (1 hunks)
🔇 Additional comments (2)
rise-dc-app/src/scheduling_components/pages/QuietHobbiesParticipant.tsx (2)

39-40: LGTM! Parent notification properly added.

The addition of onClose?.() correctly notifies the parent EventSelectionModal to close when the user exits, solving the overlay issue described in the PR. The optional chaining ensures safety if onClose is undefined.


27-31: Verify error handling behavior with parent modal.

In the error catch block, setOpen(false) is called but onClose?.() is not. This differs from handleCloseModal where both are invoked. Confirm whether the parent EventSelectionModal should remain open when hobby loading fails (allowing the user to try again or go back), or if it should also close. The same question applies to the retry error path at line 69.

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