fix(ui): reactive GENERATION + draft-delete tombstones (#106, #107)#108
Merged
iduartgomez merged 2 commits intomainfrom May 4, 2026
Merged
fix(ui): reactive GENERATION + draft-delete tombstones (#106, #107)#108iduartgomez merged 2 commits intomainfrom
iduartgomez merged 2 commits intomainfrom
Conversation
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.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
local_state::GENERATIONwas anAtomicUsize. Components calling.load(Relaxed)did not register a Dioxus reactive dep, so kept/read mutations didn't trigger re-render. Switched toGlobalSignal<usize>— readers useGENERATION()to subscribe.delete_draft_nowrace with debouncedsave_draftecho could resurrect a deleted draft. Added aDELETED_DRAFTStombstone set;replace_snapshotstrips matching ids until the delegate echo confirms deletion.Closes #106
Closes #107
Test plan
cargo check -p freenet-email-ui(use-node) cleancargo check -p freenet-email-ui --no-default-features --features example-data,no-synccleancargo clippy -p freenet-email-ui -- -D warnings(both feature sets) cleancargo test -p freenet-email-ui --features example-data,no-sync26 pass