This is a pre-release. djust 0.9.5 has shipped since: read the djust 0.9.5 release notes.
Tests
- Multi-cycle
sync_idsround-trip torture (#1412 — regression-class hardener for #1408). Addedcrates/djust_vdom/tests/torture_round_trip_with_sync.rsexercising the production server loop (diff→apply_patcheson a faithful client tracker →sync_ids→ store aslast_vdom) across 4 scenarios: three-branch tab toggle, five-boundary independent toggles (THE bug-trigger; trips at round 4 on commit a44e63cb pre-fix), long alternation under matched boundary id, and same-tag siblings around unmatched boundaries. The crate's existing torture (tests/torture_test.rs, 42 tests) and proptest fuzz (tests/fuzz_test.rs) only test single-diff correctness; this file exercises the cross-render invariant — every emitted patch's targeting handle (d/child_d/ref_d) must resolve in the client tracker — that #1408 violated. Test count: djust_vdom 228 → 232. Proptest-randomized variant filed as follow-up #1413. - Test harness extracted to
crates/djust_vdom/tests/common/mod.rs(#1415). Pure refactor; deduplicated dj-if marker helpers (dj_if_open,dj_if_close,is_dj_if_open*,match_close_idx), VNode lookup helpers, dj-if subtree manipulation, the subtree-awareapply_allpatch applier, the cross-renderassert_handles_resolveinvariant checker, and the sequentialIdGendj-id generator. Unblocks #1413, #1416, #1417, #1418, #1419, #1420 — each will be a small focused PR rather than another 200-LOC duplication of helpers.
Fixed
- VDOM
sync_idsis now dj-if-boundary-aware (#1408).diff::diff_childrenalready aligned children across<!--dj-if id="…"-->boundary swaps viadj_if_pre_pass(#1358); the post-diffsync_idsdid not, falling through tosync_ids_keyed/sync_ids_indexedand positionally pairing children regardless of branch identity. After a{% if %}branch swap, freshdjust_ids on new-branch content were overwritten by stale ids from the unmatched-old-branch — the next render's diff then emittedRemoveChild/SetAttrpatches whosechild_d/dreferenced ids the client DOM never had, leaving orphan content from the prior branch. Addedsync_ids_dj_if_pre_passmirroringdj_if_pre_pass's shape (id-only-in-OLD → skip, id-only-in-NEW → skip with fresh ids preserved, id-in-BOTH → recurse, non-boundary siblings → relative-order pairing viabuild_excluded_mask). Verified at theDJUST_VDOM_TRACE=1level: pre-fix a tab-swap diff emittedRemoveChild child_d="2y"(a stale id from a render two cycles back) for the bottom-tab content slot; post-fix it correctly emitschild_d="5m"matching what the previous diff'sInsertChildplaced there. Reproduced and verified-fixed against a downstream consumer's bottom-tab-swap reproducer. Regression test incrates/djust_vdom/tests/test_sync_ids_dj_if_1408.rs(4 cases; 3 fail pre-fix). All 228 existingdjust_vdomtests still pass.