Skip to content

fix(ui): reactive GENERATION + draft-delete tombstones (#106, #107)#108

Merged
iduartgomez merged 2 commits intomainfrom
debug/106-107
May 4, 2026
Merged

fix(ui): reactive GENERATION + draft-delete tombstones (#106, #107)#108
iduartgomez merged 2 commits intomainfrom
debug/106-107

Conversation

@iduartgomez
Copy link
Copy Markdown
Contributor

Summary

Closes #106
Closes #107

Test plan

  • cargo check -p freenet-email-ui (use-node) clean
  • cargo check -p freenet-email-ui --no-default-features --features example-data,no-sync clean
  • cargo clippy -p freenet-email-ui -- -D warnings (both feature sets) clean
  • cargo test -p freenet-email-ui --features example-data,no-sync 26 pass
  • Manual iso 2-node: alice → bob, bob clicks → row stays as read
  • Manual iso 2-node: alice → bob, alice's Drafts stays empty after Send

Two related local_state correctness bugs surfaced during cross-node
manual testing post-#102/#104:

#106 — clicking an inbox row removed it from the list. `mark_as_read`
moves the row from the live `messages` Vec into the per-alias `kept`
HashMap and bumps `GENERATION`, but `GENERATION` was an `AtomicUsize`
and components called `.load(Relaxed)` on it. Atomic loads do NOT
register a Dioxus reactive dep, so the kept-merge loop in `MessageList`
did not re-run after the bump and the row stayed gone until something
else dirtied the component. Switched `GENERATION` to a `GlobalSignal<usize>`;
readers use `GENERATION()` to subscribe properly.

#107 — sent messages re-appeared in Drafts. `delete_draft_now` removes
the draft locally and asynchronously asks the delegate to delete. If a
debounced `save_draft` was already past the autosave-token guard and
in-flight when Send fires, its delegate-echoed snapshot (with the draft
still present) lands AFTER the local delete and `replace_snapshot`
overwrites the optimistic delete. Added a `DELETED_DRAFTS` tombstone
set keyed by `(alias, draft_id)`; `replace_snapshot` strips matching
ids from incoming snapshots and clears the tombstone once the delegate
echo no longer contains the id.
@iduartgomez iduartgomez merged commit 30ecd6c into main May 4, 2026
4 checks passed
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.

Sent messages leaking into Drafts folder after cross-node send Inbox row disappears when clicked instead of staying as read

1 participant