Skip to content

fix(calendar): make the enable-calendar prompt usable on mobile - #5407

Draft
gbirman wants to merge 2 commits into
mainfrom
gbirman/macro-2754-enable-calendar-option-looks-horrible-on-mobile
Draft

fix(calendar): make the enable-calendar prompt usable on mobile#5407
gbirman wants to merge 2 commits into
mainfrom
gbirman/macro-2754-enable-calendar-option-looks-horrible-on-mobile

Conversation

@gbirman

@gbirman gbirman commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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.

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

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: efc61be1-8045-4f4b-8da9-ebe023a80849

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Toast dismissals now persist across page reloads.
    • Mobile devices display stacked persistent prompts with clear close controls and spacing.
    • Mobile prompt visibility is limited to one where appropriate, while desktop behavior remains unchanged.
    • Toasts now handle queued notifications more smoothly as prompts are dismissed.
  • Bug Fixes

    • Improved handling of loading states, stale dismissals, invalid saved data, and toast replacement behavior.

Walkthrough

The 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)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format, is 63 characters long, and accurately describes the mobile calendar prompt fix.
Description check ✅ Passed The description directly explains the mobile toast changes, dismissal persistence, and reauthentication behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 211f0b8 and ab1eb5f.

📒 Files selected for processing (6)
  • apps/web/src/features/auth/CalendarPermissionPrompt.tsx
  • apps/web/src/features/auth/GmailReauthenticationPrompt.tsx
  • apps/web/src/lib/core/component/Toast/Toast.tsx
  • apps/web/src/lib/core/component/Toast/ToastRegion.tsx
  • apps/web/src/lib/core/component/Toast/useKeyedPersistentToasts.test.ts
  • apps/web/src/lib/core/component/Toast/useKeyedPersistentToasts.ts

Comment thread apps/web/src/lib/core/component/Toast/useKeyedPersistentToasts.ts Outdated
Comment thread apps/web/src/lib/core/component/Toast/useKeyedPersistentToasts.ts Outdated
@gbirman
gbirman marked this pull request as draft August 4, 2026 20:43
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant