Skip to content

docs: note x-modelable JSON clone limitation - #4880

Open
pooridev wants to merge 1 commit into
alpinejs:mainfrom
pooridev:docs/modelable-json-clone-limitation
Open

docs: note x-modelable JSON clone limitation#4880
pooridev wants to merge 1 commit into
alpinejs:mainfrom
pooridev:docs/modelable-json-clone-limitation

Conversation

@pooridev

Copy link
Copy Markdown

What

Document that x-modelable clones values with JSON.parse(JSON.stringify()), so non-JSON types (File, Map, Set, class instances, DOM nodes, …) are silently dropped. Point to $dispatch('input', value) as the existing escape hatch that x-model already understands.

Fixes #4873

Why

Anyone exposing a file picker (or other non-plain-object state) through x-modelable gets an outer value that looks populated but has empty {} elements. The docs currently read as a general-purpose two-way binding with no serializability caveat.

Test plan

  • Check the x-modelable docs page for the new note
  • Confirm the $dispatch link to the x-model section is correct

Made with Cursor

x-modelable syncs via JSON.parse(JSON.stringify()), which silently
drops File, Map, Set, and other non-JSON values. Point users at
$dispatch('input') for those cases. Fixes alpinejs#4873.

Co-authored-by: Cursor <cursoragent@cursor.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.

x-modelable/entangle() silently drops data for non-plain-object values (File, Map, Set, ...) via JSON round-trip clone

1 participant