Skip to content

chore: update livetemplate to v0.7.3#18

Closed
adnaan wants to merge 2 commits intomainfrom
chore/update-livetemplate-v0.7.3
Closed

chore: update livetemplate to v0.7.3#18
adnaan wants to merge 2 commits intomainfrom
chore/update-livetemplate-v0.7.3

Conversation

@adnaan
Copy link
Copy Markdown
Contributor

@adnaan adnaan commented Dec 22, 2025

Summary

Updates all examples to use livetemplate v0.7.3 which includes critical fixes for range statics handling.

Changes

  • Updated livetemplate dependency from v0.7.0 to v0.7.3 in all examples:
    • avatar-upload
    • chat
    • counter
    • graceful-shutdown
    • login
    • observability
    • production/single-host
    • testing/01_basic
    • todos
    • trace-correlation

Why

livetemplate v0.7.3 includes:

  • fix: ensure Range.Statics is always set for diff operations - Fixes empty→items transitions
  • fix: support heterogeneous range items with per-item statics - Adds StaticsMap support

This update is required for compatibility with @livetemplate/client v0.7.2+ which depends on these fixes.

Related PRs

🤖 Generated with Claude Code

Updates all examples to use livetemplate v0.7.3 which includes:
- fix: ensure Range.Statics is always set for diff operations
- fix: support heterogeneous range items with per-item statics

This fixes compatibility with livetemplate/client v0.7.2+ which
requires the StaticsMap support for heterogeneous ranges.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 22, 2025 06:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the livetemplate dependency from v0.7.0 to v0.7.3 across all example projects to incorporate critical bug fixes for range statics handling.

  • Updates 10 example projects to use livetemplate v0.7.3
  • Includes corresponding go.sum checksum updates
  • Prepares examples for compatibility with upcoming @livetemplate/client v0.7.2+

Reviewed changes

Copilot reviewed 10 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
avatar-upload/go.mod Updated livetemplate dependency to v0.7.3
avatar-upload/go.sum Updated checksums for livetemplate v0.7.3
chat/go.mod Updated livetemplate dependency to v0.7.3
chat/go.sum Updated checksums for livetemplate v0.7.3
counter/go.mod Updated livetemplate dependency to v0.7.3
counter/go.sum Updated checksums for livetemplate v0.7.3
graceful-shutdown/go.mod Updated livetemplate dependency to v0.7.3
graceful-shutdown/go.sum Updated checksums for livetemplate v0.7.3
login/go.mod Updated livetemplate dependency to v0.7.3
login/go.sum Updated checksums for livetemplate v0.7.3
observability/go.mod Updated livetemplate dependency to v0.7.3
observability/go.sum Updated checksums for livetemplate v0.7.3
production/single-host/go.mod Updated livetemplate dependency to v0.7.3
production/single-host/go.sum Updated checksums for livetemplate v0.7.3 and additional dependency go.mod entries
testing/01_basic/go.mod Updated livetemplate dependency to v0.7.3
testing/01_basic/go.sum Updated checksums for livetemplate v0.7.3 and additional dependency go.mod entries
trace-correlation/go.mod Updated livetemplate dependency to v0.7.3
trace-correlation/go.sum Updated checksums for livetemplate v0.7.3
todos/go.mod Updated livetemplate dependency to v0.7.3
todos/go.sum Updated checksums for livetemplate v0.7.3

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Updates lvt dependency to include:
- livetemplate v0.7.3 (StaticsMap support)
- embedded @livetemplate/client v0.7.3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@adnaan adnaan closed this Dec 24, 2025
adnaan added a commit that referenced this pull request Apr 25, 2026
…navigation (#74)

* feat: patterns example Session 4 (patterns #17-21) — dialogs, tabs & navigation

Adds five new patterns under a new "Dialogs, Tabs & Navigation" category in
the patterns example app, covering the Tier-1/Tier-2 navigation primitives
that LiveTemplate exposes on top of native browser features.

  #17 Modal Dialog          — native <dialog> + Invoker Commands
                              (command/commandfor) + #hash deep linking;
                              field-level validation inside the open dialog
                              exercises the client v0.8.33 morphdom fix
  #18 Confirm Dialog        — per-item <dialog id="confirm-{{.ID}}"> for
                              destructive-action confirmation, button value
                              attribute (no hidden inputs), per-item hash
                              linking
  #19 Tabs (HATEOAS)        — <a href="?tab=…"> driven by the in-band
                              __navigate__ WebSocket action (server v0.8.19+,
                              client v0.8.26+); Mount-only controller with
                              validTabs allowlist
  #20 SPA Navigation        — explainer page covering same-pathname
                              __navigate__, cross-pathname reconnect, and
                              the lvt-nav:no-intercept opt-out
  #21 Keyboard Shortcuts    — Tier-2 lvt-on:window:keydown + lvt-key for a
                              command-palette-style overlay, plus a Tier-1
                              form fallback

Library bumped to v0.8.21 (from a stale v0.8.19 pre-release pseudo-version)
to align go.sum with the latest tagged release. Examples/.gitignore now
includes patterns/patterns so the compiled binary doesn't reappear after
local `go run` cycles.

E2E coverage:
  - TestModalDialog — Open_Via_Button, Open_Via_Hash_Link, Submit_Invalid_…,
    Submit_Valid_…, Browser_Back_Closes_Dialog, UI_Standards, Visual_Check
  - TestConfirmDialog — Open_Specific_Item_Confirm, Cancel_…, Confirm_Deletes
    Per_Item_Hash_Link_…, UI_Standards, Visual_Check
  - TestTabs — Default_Tab_…, Click_Settings_…, Tab_Switch_Uses_WebSocket_…
    Direct_URL_Load_…, Invalid_Tab_Falls_Back_…, UI_Standards, Visual_Check
  - TestSPANavigation — Initial_Load, Same_Pathname_Step_Update_No_HTTP,
    External_Link_Has_No_Intercept_Attribute, UI_Standards, Visual_Check
  - TestKeyboardShortcuts — Slash_Key_Opens_Panel, Escape_Closes_Panel,
    Tier1_Form_Fallback_Works, UI_Standards, Visual_Check
  - cross_handler_nav_test.go — Index_To_Modal_Dialog_No_Stale_Dom,
    Tabs_Same_Pathname_Uses_WebSocket,
    SPA_Navigation_Cross_Pathname_Reconnects

All five Category 5 entries in data.go flipped to Implemented:true.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: trim Session 4 comment noise

Drops version-specific references (v0.8.33, v0.8.19+, etc.) and
"Session 4"-style task references from controller doc-comments and test
inline comments. Also removes comments that restated test mechanics
already evident from the test code, and pares the controller doc-comments
to the load-bearing WHY (e.g. "errors must render inside still-open
dialog", "button value attribute, not hidden input"). No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix: address Claude/Copilot bot review comments

Tabs:
- Mount() now resets to "overview" for any unknown ?tab= value
  regardless of current state, matching the template's "fall back
  silently to Overview" claim. Previously a user already on Settings
  who hit ?tab=garbage would silently keep Settings.
- Reword tabs.tmpl: validTabs is a package-level allowlist, not
  controller instance state.
- Use {{else if}} for the mutually-exclusive tab content blocks.

Modal Dialog:
- Add explicit dialog-close assertion after Submit_Valid_Form. Catches
  a hypothetical bug where the success flash appears but the dialog
  fails to close.
- Document why we use BindAndValidate (rather than ctx.ValidateForm
  used by Sessions 1–3 form patterns): ExtractFormSchema does not
  currently surface the form schema for forms inside <dialog>, so the
  explicit struct + validator tags is the same shape used by
  examples/dialog-patterns and works reliably.

Confirm Dialog:
- Reword "Refresh to reseed the list" to also acknowledge that
  navigating away and back reseeds (via Mount).

SPA Navigation:
- Move the period outside <strong> in the Step indicator (cosmetic).

Tests:
- Restore window.fetch via t.Cleanup so a mid-test failure cannot
  leak the override into later subtests (3 places: TestTabs,
  TestSPANavigation, and the cross-handler version which is removed
  below).
- Drop the duplicate Tabs_Same_Pathname_Uses_WebSocket subtest from
  cross_handler_nav_test.go — the same assertion lives in
  TestTabs/Tab_Switch_Uses_WebSocket_Not_HTTP.
- Capture and check the chromedp.Run error around the leak-detection
  Evaluate in Index_To_Modal_Dialog_No_Stale_Dom; treat "no-wrapper"
  as a hard failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix: address Claude bot round-2 review

Comment style:
- Trim controller doc-comments to one short line each, per CLAUDE.md
  ("never write multi-line comment blocks").
- Drop state_navigation.go type and field comments (they were
  restating identifier names).
- Compress validateNav comment to one line.

Tabs:
- Rewrite Mount() as a switch with one-line comments on each branch
  so the "explicit unknown → reset" vs "first load → default" intent
  is legible.

Confirm Dialog:
- Rename the per-row form `confirmDelete` → `delete` to match the
  submit button's name attribute.
- Add a {{/* ... */}} comment explaining why the dialogs render
  outside the table (so future maintainers don't try to nest them
  back into <tbody>).

Tests:
- Rename `hasDeleted` → `rowExists` (the variable holds the existence
  result, not a deletion flag).
- Rename `__origFetch2` → `__origFetchSPA` (less collision-prone if
  more fetch-mocking tests get added).
- Add Open_Button_Click_Opens_Panel subtest to TestKeyboardShortcuts;
  the keyboard path was covered but the Tier-1 form-button click
  through name="open" wasn't.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: address Claude bot round-3 nits

- Inline comment near ctx.GetString("value") in ConfirmDialog.Delete
  documenting that "value" is the framework's key for the clicked
  submit button's value attribute (independent of the button's name).
  Same idiom as examples/dialog-patterns.
- Inline comment in SPANavController.Mount noting that out-of-range
  ?step= values fall through to the default — symmetric with the
  TabsController handling.
- Template comment in keyboard-shortcuts.tmpl marking the search
  input as intentionally decorative (wiring to Change()/Submit() is
  out of scope for the keyboard-shortcut demo).

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix: add method="POST" to forms + verify form state after Save

The four Session 4 forms (modal-dialog #save, confirm-dialog #delete,
keyboard-shortcuts #closePanel + #openPanel) were missing method="POST"
on the <form> tag. CLAUDE.md requires it for the Tier-1 HTTP POST
fallback path; without it the no-JS user flow breaks. All four forms
now match the convention used by Sessions 1–3.

Also adds the form-state-after-mutation assertion to
Submit_Valid_Form_Closes_Dialog_And_Updates_State per the project's E2E
checklist: re-opens the dialog after save and verifies the name input
now holds the saved value (the value="{{.Name}}" template expression
should have rerendered).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test: cover ?step=3 + out-of-range step in TestSPANavigation

Adds Step_3_Direct_URL_Activates and Out_Of_Range_Step_Falls_Back_To_Default
subtests so the spaNavMaxStep clamp is exercised end-to-end (mirroring the
TestTabs/Invalid_Tab_Falls_Back_To_Default precedent).

Also adds a one-line comment in ConfirmDialogController.Delete noting that
unknown ids are an intentional no-op (next render reconciles drift between
client and server item lists).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: tidy form names in keyboard-shortcuts and modal-dialog

Per the action resolution order (button name → form name → "submit"),
the form names "closePanel"/"openPanel" in keyboard-shortcuts.tmpl were
shadowed by the button names "close"/"open" and never reached. Renamed
to match the buttons so the form-name encoding is honest if a future
contributor reads it for routing semantics.

modal-dialog.tmpl had a duplicate name="save" on both the form and the
submit button — the button wins, so the form attribute was redundant.
Dropped it.

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: clarify confirm-dialog empty-state reseed conditions

Mount re-seeds whenever state.Items is empty AND ctx.Action() == "" —
which includes WebSocket reconnects (network blip, tab backgrounded),
not just explicit reload/navigation. Updated the empty-state message
to mention all three triggers so it doesn't contradict the code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: address Claude bot round-8 nits

- spa-navigation.tmpl: rel="noopener" → "noopener noreferrer" on the
  external link (idiomatic for target="_blank"; readers will copy this
  pattern).
- keyboard-shortcuts.tmpl: extended the decorative-search-input comment
  to note the autofocus + Escape-handling interaction caveat. Production
  use should defer focus to a wrapper or drop autofocus.
- handlers_navigation.go: brief comment in ConfirmDialogController.Delete
  noting that id is a server-rendered Item.ID echoed back via the form
  (not free-form user input), so no allowlist check is needed.

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: address Claude bot round-9 nits

- keyboard-shortcuts.tmpl: drop autofocus from the decorative search
  input. The input is wired to nothing; autofocus only created an
  Escape-key interaction caveat. Updated the template comment to
  document the trade-off explicitly.
- confirm-dialog.tmpl: soften the empty-state message — drop the
  "wait for the WebSocket to reconnect" claim. Reseed-on-reconnect
  is contingent on framework state-clone semantics that could change;
  the safer "reload or navigate away and back" claim is unambiguous.

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix: scope keyboard-shortcut listeners by panel state

Previously the outer <article> bound lvt-on:window:keydown="open"
unconditionally. While the panel was open, "/" still routed to Open()
which bailed out via the re-entrancy guard — but the WebSocket round-
trip happened regardless.

Now the outer article binds either the Open or the Close listener
based on .PanelOpen, so stray keypresses can't trigger no-op round-
trips. The inner panel article keeps its aria-label.

Also replaces the decorative search input's lack of autofocus with an
explicit `disabled` attribute so the lack-of-affordance is visible to
the user (they can see the field is non-functional, and it can't grab
focus to interfere with the Escape handler).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: defensive ActiveTab invariant guard in TabsController.Mount

Add a belt-and-suspenders fallback after the if-block: regardless of
which branch ran (or if the if-block was skipped because Action() != ""),
state.ActiveTab is guaranteed to be in validTabs by the time Mount
returns. Closes a hypothetical edge case where a malformed message
could route through Mount with the action set but ActiveTab unset.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants