djust 0.2.2

StableReleased
Install
pip install djust==0.2.2

Before you upgrade, read Deprecated below.

Fixed

  • Stale Closure Args on VDOM-Patched Elements — After deleting a todo, the remaining button's click handler sent the wrong _args (stale closure from bind time) because SetAttribute patches updated the dj-click DOM attribute but not the listener closure. Event listeners now re-parse dj-* attributes from the DOM at event time. Also sets dj-* as DOM attributes in createNodeFromVNode and marks elements as bound to prevent duplicate listeners. (#205)
  • VDOM: Non-breaking Space Text Nodes Stripped — Rust parser stripped  -only text nodes (used in syntax highlighting) because char::is_whitespace() includes U+00A0. Now preserves \u00A0 text nodes in parser, to_html(), and client-side path traversal. Also adds sync_ids() to prevent ID drift between server VDOM and client DOM after diffing, and 4-phase patch ordering matching Rust's apply_patches(). (#199)
  • CSRF Token Lookup on Formless Pages — Pages without a <form> element failed to send CSRF tokens with WebSocket events. Token lookup now falls back to the csrftoken cookie. (#210)
  • Codegen Crash on Numeric Index Paths — Template expressions like {{ posts.0.url }} produced paths starting with a numeric index (0.url), generating invalid Python (obj.0). Codegen now skips numeric-leading paths since list items are serialized individually.
  • JIT Serialization Pipeline — Fixed multiple issues in JIT auto-serialization: (#140)
    • M2M .all() traversal now generates correct iteration code in codegen serializers
    • @property attributes are now serialized via Rust→Python codegen fallback when Rust can't access them
    • list[Model] context values (not just QuerySets) now receive full JIT optimization with select_related/prefetch_related
    • Nested dicts containing Model/QuerySet values are now deep-serialized recursively
    • _djust_annotations model class attribute for declaring computed annotations (e.g., Count) applied during query optimization
    • {% include %} templates are now inlined for variable extraction, so included template variables get JIT optimization
    • Rust template parser now correctly prefixes loop variable paths (e.g., item.field inside {% for item in items %})
  • {% include %} After Cache Restoretemplate_dirs was not included in msgpack serialization of RustLiveView. After a cache hit, the restored view had empty search paths, causing {% include %} tags to fail with "Template not found". Now calls set_template_dirs() on both WebSocket and HTTP cache-hit paths.
  • VDOM Replace Sibling Grouping — Fixed data-djust-replace inserting children into wrong parent when the replace container has siblings. groupPatchesByParent() now uses the full path for child-operation patches, and groupConsecutiveInserts() checks parent identity before batching. (#144)
  • VDOM Replace Child Removal — Fixed data-djust-replace not removing old children before inserting new ones, causing duplicate content on re-render. (#142, #143)
  • Context Processor Precedence — View context now takes precedence over context processors. Previously, context processors could overwrite view-defined variables (e.g., Django's messages processor overwriting a view's messages variable).
  • VDOM Keyed Diff Insert Ordering — Fixed apply_patches for keyed diff insert ordering where items were inserted in the wrong position. (#154)
  • VDOM MoveChild Resolution — Fixed MoveChild in apply_patch by resolving children via djust_id instead of index. (#150)
  • Debug Toolbar: Received WebSocket Messages Not Captured — Network tab now captures both sent and received WebSocket messages by intercepting the onmessage property setter (not just addEventListener). (#188)
  • Debug Toolbar: Events Tab Always Empty — Events tab now populates by extracting event data from sent WebSocket messages and matching responses, replacing the broken window.liveView hook. (#188)
  • Debug Panel: Handler Discovery, Auto-loading, Tab Crashes — Handler discovery now finds all public methods; debug-panel.js auto-loads; handler dict normalized to array; retroactive WebSocket hooking for late-loading panels. (#191, #197)

Added

  • Debug Panel: Live Debug Payload — When DEBUG=True, WebSocket event responses now include a _debug field with updated variables, handlers, patches, and performance metrics. (#191) See docs/website/advanced/debug-panel.md.
  • Debug Toolbar: Event Filtering — Events tab filter controls to search by event/handler name and filter by status. (#180)
  • Debug Toolbar: Event Replay — Replay button (⟳) that re-sends events through the WebSocket with original params. (#181)
  • Debug Toolbar: Scoped State Persistence — Panel UI state scoped per view class via localStorage. (#182)
  • Debug Toolbar: Network Message Inspection — Directional color coding and copy-to-clipboard for expanded payloads. (#183)
  • Debug Toolbar: Test Harness — Integration tests against the actual DjustDebugPanel class. (#185)
  • VDOM Proptest/Fuzzing — Property-based testing for the VDOM diff algorithm with proptest. (#153)
  • Duplicate Key Detection — VDOM keyed diff now warns on duplicate keys. (#149)
  • Branding Assets — Official logo variants (dark, light, icon, wordmark, transparent). (#208, #213)

Deprecated

  • @event decorator alias — The @event shorthand is deprecated in favor of @event_handler. @event will be removed in v0.3.0. A deprecation warning is emitted at import time. (#141)

Changed

  • Internal: LiveView Mixin Extraction — Refactored monolithic live_view.py into focused mixins: RequestMixin, ContextMixin, JITMixin, TemplateMixin, RustBridgeMixin, ComponentMixin, LifecycleMixin. No public API changes. (#130)
  • Internal: Module Splits — Split client.js into source modules with concat build, extracted websocket_utils.py, session_utils.py, serialization.py, split state_backend.py into state_backends package, split template_backend.py into template package. (#124, #125, #126, #128, #129)
  • Dependencies — Upgraded uuid 1.19→1.20, thiserror 1→2, bincode 1→2, happy-dom 20.3.7→20.4.0, actions/setup-python 5→6, actions/upload-artifact 4→6, actions/checkout 4→6, softprops/action-gh-release 1→2

All releases · Atom feed