Skip to content

fix(messages): keep the folder list stable on focused-message archive - #14

Closed
antonio-ivanovski wants to merge 3 commits into
feat/mail-action-undofrom
fix/focused-archive-list-refresh
Closed

antonio-ivanovski wants to merge 3 commits into
feat/mail-action-undofrom
fix/focused-archive-list-refresh

Conversation

@antonio-ivanovski

@antonio-ivanovski antonio-ivanovski commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #310

This builds on feat/mail-action-undo (#310). It carries the original goal of the work: archiving the focused message must not refresh or blank the folder list.

GitHub cannot base an upstream PR on a fork-only branch, so this stacked PR lives in the fork and targets feat/mail-action-undo. Review the first PR upstream at #310. Once #310 merges, retarget it to main upstream; the diff is the three commits above the base.

What changed

  • One list for the folder. The list now lives in the shared folder layout instead of each route page. Opening a message hides it without unmounting it; archiving the open message returns to the same DOM node, not a freshly mounted list.
  • The row leaves before the request. A committed move prunes the row in place using membership that mirrors the server query: Inbox drops it, Starred keeps it, custom folders ignore snooze, and same-status moves are no-ops.
  • Optimistic through undo. Moves get a tombstone keyed by list identity and page. Undo restores the row from that tombstone before the undo response, and repeated peeks, remounts, and refetches replay the same overlay instead of consuming it once.
  • Narrow rollback. Undo overlays only the fields the action changed and falls back to the membership captured before the click. Read/star settlements never clear or restore move tombstones.

Proof

The before/after recording is attached. The list request is delayed by 4 seconds in both clips:

  • Before: archiving the open message returns to a freshly mounted list showing 0 - 0 of 0 until the request resolves.
  • After: the same list element stays painted, the row is gone immediately, and the count stays 1 - 4 of 4 while the request is held.

Testing

  • node --test tests/*.test.mjs — 798 tests, 789 pass, same 7 pre-existing failures as main.
  • tsc --noEmit — clean.
  • Production build — passes.
  • New/updated coverage: tests/message-membership-overlay.test.mjs, tests/message-list-optimistic-removal.test.mjs, tests/message-list-membership.test.mjs, and the list-DOM identity cases in tests/message-selection-navigation.test.mjs.
focused-archive-before-after.mp4

Opening a message unmounted the folder list and let MessageSplitLayout
render a separate compact copy beside the reader. Archiving then cleared
the list cache and navigated back to the folder, where a freshly mounted
list painted an empty first frame until its request returned.

Move list ownership into the shared folder layout so it survives the
index <-> message route change. The layout now renders one list that
expands to full width when no message is open and hides (without
unmounting) while reading. Message details remain owned by the route.

The index pages now render nothing; their layout supplies the list.
Add reconciliation tests asserting the same list DOM node survives
opening and closing a message, including single-column reading.
A successful move cleared the list cache and waited for the debounced
refetch, so the moved row lingered until the response landed.

Emit the committed per-message state from the shared action executor and
prune the mounted list in place. Membership mirrors the server query:
Starred ignores status changes, custom folders ignore snooze, and
same-status moves are no-ops. Direction-dependent optimistic decisions
wait for the committed state on grouped rows, whose members may mix
directions. Conversation rows keep their representative until the
refetch and disappear only after their last scoped member.

An optimistically emptied intermediate page now waits for backfill
instead of skipping it. Permanent delete reports the same removal event.

Covered by delayed-response, stale-response, thread, Starred,
custom-folder, Snoozed, duplicate-event, and grouped-member tests.
Moves now disappear before the refetch and return before the undo
response, while the server remains the authority for reconciliation.

The executor computes the target membership before the request. A
membership store carries compact known rows, a pending overlay, and
tombstones keyed by list identity and page. Grouped rows defer
direction-dependent actions (spam, snooze) until the committed response
carries per-member state, because a representative's direction says
nothing about its peers.

Undo overlays only the fields the action changed and restores tombstones
from the same page. Skipped or failed records roll back to the membership
captured on screen before the click, never to a historical applied
snapshot. A failed undo keeps its tombstone so a retry still restores
instantly after navigating away and back.

Read/star settlements no longer touch move tombstones. Optimistic events
stay in the originating tab; other tabs receive the committed state and
refetch. List ingress derives rows and totals from the raw cached
response, so repeated peeks and remounts cannot consume restoration once.

Covered by real-hook and real-executor tests for delayed requests,
in-flight list ingress, failure rollback, undo before the server answer,
repeated ingress, remounts, partial undo, sequential conversation
removals, StrictMode, and read/star settlements.
@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7d1bafe9-d258-4c43-987c-45a819a25a4f

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@antonio-ivanovski

Copy link
Copy Markdown
Owner Author

Superseded by the upstream draft PR: hieunc229#311

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