fix(calendar): make the enable-calendar prompt usable on mobile - #5407
fix(calendar): make the enable-calendar prompt usable on mobile#5407gbirman wants to merge 2 commits into
Conversation
The mobile branch of the custom toast layout stripped the body and the close button, so a persistent prompt reduced to a bare truncated title with no way to dismiss it, and its action button was styled `text-panel` — a background token — leaving it near-invisible on the dark island. Persistent prompts now get the full card on mobile (description, close button, actions on their own row) and the island spans the dock gutter instead of 90vw inside an already-padded container. Two related fixes the above exposed: persistent toasts no longer occupy the mobile region's single replaceable slot, so a passing "Copied" toast can't tear one down and permanently suppress it; and with several inboxes flagged, prompts queue one at a time on a phone rather than burying the screen. Closing the calendar prompt now sticks across reloads — nothing is broken while calendar is off, and Settings > Email keeps a permanent per-inbox "Enable calendar" button. Reauth keeps re-asking every session, since that one means mail is actually dead.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change adds local storage for persistent toast dismissals and restores them after required data loads. Toast queues now support configurable visibility limits and promotion of queued items. Persistent toasts no longer replace transient active toasts. Mobile persistent custom toasts render as stacked cards with separated actions. Calendar and Gmail prompts limit visible mobile prompts while desktop visibility remains unlimited. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/src/lib/core/component/Toast/useKeyedPersistentToasts.ts`:
- Around line 106-124: Update the createEffect in useKeyedPersistentToasts so
that when maxVisible decreases, existing live toastIds are trimmed to the cap,
dismissing surplus entries through dismissToast while preserving the current
ordering. Add a reactive test that shows multiple prompts, lowers the visibility
cap, and verifies the excess prompts are dismissed.
- Around line 72-79: Track self-dismissal and toast identity by toast instance
rather than only by item key in the toast lifecycle logic around toastIds,
selfDismissed, and dismissToast. Associate each callback’s teardown state with
its specific toast ID or instance token, and only remove or consume state when
that token matches, preserving newer toasts when an older delayed onDismiss
runs; add a regression test covering out-of-order unmounting.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2de60881-7be9-4854-aa03-e0d065f2496b
📒 Files selected for processing (6)
apps/web/src/features/auth/CalendarPermissionPrompt.tsxapps/web/src/features/auth/GmailReauthenticationPrompt.tsxapps/web/src/lib/core/component/Toast/Toast.tsxapps/web/src/lib/core/component/Toast/ToastRegion.tsxapps/web/src/lib/core/component/Toast/useKeyedPersistentToasts.test.tsapps/web/src/lib/core/component/Toast/useKeyedPersistentToasts.ts
A toast unmounts at the end of its exit animation. If its item left and returned in that window, the key already belonged to a replacement, and the departing toast's `onDismiss` retracted the replacement's entry and consumed its teardown marker — leaving a live toast untracked, so the next effect run built a duplicate, and a genuine close could be read as our own teardown and go unrecorded. Track live toasts by object identity so a stale unmount only answers for itself. `maxVisible` also only gated new toasts, so a cap that tightened under prompts already on screen — a tablet rotating into phone width — left them stacked on a layout with no room. Retract the surplus back into the queue instead.
The mobile custom-toast layout stripped the body and close button, so the persistent "Enable calendar" prompt reduced to a bare title that couldn't be dismissed, with its action styled
text-panel(a background token) and near-invisible. Persistent prompts now get the full card on mobile, queue one at a time instead of stacking, and no longer occupy the region's single replaceable slot — a passing transient toast used to tear one down and suppress it for the session.Closing the calendar prompt persists across reloads, since nothing is broken while calendar is off and Settings > Email keeps a per-inbox "Enable calendar" button; reauth still re-asks every session.