Skip to content

Restore form state before deferred head scripts#3912

Open
scriptogre wants to merge 1 commit into
bigskysoftware:four-devfrom
scriptogre:4.0/restore-cached-head-scripts
Open

Restore form state before deferred head scripts#3912
scriptogre wants to merge 1 commit into
bigskysoftware:four-devfrom
scriptogre:4.0/restore-cached-head-scripts

Conversation

@scriptogre

Copy link
Copy Markdown
Collaborator

Description

During a cached history restore, hx-head appends deferred head scripts from htmx:after:swap. Form annotations are restored afterward, so those scripts observe default form values instead of the cached values.

Carry the existing restore detail through htmx:history:cache:after:restore and append cached deferred scripts there, after form state restoration. The existing detail.item field is preserved.

Corresponding issue: none

Testing

Added an integration test that restores a cached input and verifies a deferred head script reads its restored value.

Chromium: 1,588 passed, 0 failed, 6 skipped.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct htmx 4 development branch (four-dev)
  • This is a bugfix
  • I ran the test suite locally and verified that it succeeded

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.

1 participant