fix(core): return raw host objects (File/Blob) from form.data#2
Open
LouisHaftmann wants to merge 2 commits into
Open
fix(core): return raw host objects (File/Blob) from form.data#2LouisHaftmann wants to merge 2 commits into
LouisHaftmann wants to merge 2 commits into
Conversation
on-change lazily proxies nested objects on read and treated host objects like File/Blob as plain objects, so form.data.<path> returned a Proxy wrapping the File. Native accessors (name, size, type, arrayBuffer) are bound to internal slots and throw "Illegal invocation" when the receiver is the Proxy instead of the real object. Patch on-change's prepareValue to treat any non-plain object that isn't a tracked builtin (Array/Date/Map/Set/typed array) as an opaque leaf, returning it by reference and never wrapping it. This fixes form.data, field.value and field.model, which all read through the proxy.
LouisHaftmann
force-pushed
the
fix/form-data-raw-host-objects
branch
from
July 21, 2026 10:24
1888d56 to
51506d7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
form.datais wrapped byon-changefor dirty tracking. on-change lazily proxies every nested object on read and treatsFile/Blobas plain objects — soform.data.files[0]returned aProxywrapping the File. Native accessors (.name/.size/.type/.arrayBuffer()) are bound to internal slots and throwTypeError: Illegal invocationwhen the receiver is the proxy instead of the real object.toRawdoesn't unwrap it (it's an on-change proxy, not a Vue reactive), andfield.valueonly worked by accident.Vue's
reactivealready leaves host objects raw (getTargetType→INVALID), so on-change was the sole culprit.Fix
on-change 6.0.2 (latest) has no leaf/allow-list hook, so this adds a pnpm patch to its
prepareValue: any non-plain object that isn't a tracked builtin (Array/Date/Map/Set/ typed array) is returned by reference and never wrapped. This fixesform.data,field.value, andfield.modelat once (all read through the proxy), preserves object identity — so dirty tracking still fires on identity change with no blob deep-diff — and confirmsklona/fullclonesFileby reference.Tests
form.data.<path>returns raw File/Blob with working native getters;field.valueidentity stays raw after an unrelated change + re-validation; File insourceValuessurvives clone +reset(); dirty tracking fires on file change.field.modelreturns the raw File.Notes
isBuiltinWithMutableMethods, which on-change intentionally tracks). Acceptance only required File/Blob.core > field > readonly, entirereactsuite) are pre-existing onmasterand unrelated: Vue warn dedup, andreact-test-renderer.actremoved in React 19.🤖 Generated with Claude Code