ISSUE DESCRIPTION defineModel on Firefox does not work as expected Vue version 3.5.17…
- User
ISSUE DESCRIPTION
defineModel on Firefox does not work as expected
Vue version
3.5.17
Link to minimal reproduction
Steps to reproduce
- Use firefox
- Enter anything in the field. It should be blocked and only show "a", but it wont on firefox.
What is expected?
It should only keep "a" and nothing else should "make it through"
What is actually happening?
Seems like either a race condition or firefox not updating at the same time as Chrome? no clue.
System Info
shellSystem: OS: Windows 11 10.0.26100 CPU: (20) x64 Intel(R) Core(TM) i5-14600K Memory: 12.60 GB / 31.77 GB Binaries: Node: 22.16.0 - C:\nvm4w\nodejs\node.EXE npm: 10.9.2 - C:\nvm4w\nodejs\npm.CMD Browsers: Edge: Chromium (134.0.3124.85) Internet Explorer: 11.0.26100.1882 -- Its not showing my actual browser: Firefox 139.0.4Any additional comments?
No response
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository using command. Additionally, you can use and to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Assistant
I’ll first inspect the repository structure and status, then decode or otherwise recover the playground reproduction so I can identify the relevant runtime path and existing tests.
- Assistant
The working tree is clean and this is the Vue core monorepo. I’ll inspect the local playground’s URL serialization implementation to decode the supplied hash exactly rather than infer the component from the prose.
- Assistant
rgis unavailable in this environment, so I’ll use recursivegrepand inspect the matching playground files. - Assistant
I found hash handling in
App.vue; I’ll open it along with its serialization utilities and the runtime DOM v-model implementation/tests, since input reconciliation is the likely browser-sensitive area. - Assistant
The model directive already forces
el.valueduringbeforeUpdate, so the key is likely whether a component update is scheduled when adefineModelsetter rejects/transforms input back to the same model value. I’ll decode the reproduction and inspect the macro/runtime helper behavior plus tests around custom model setters. - Assistant
The serialized payload uses the REPL’s
atouhelper. I’ll locate that helper, decode the exact files, and readuseModelplus the relevant late test cases that may already cover same-value transformed emissions. - Assistant
useModelcontains an existing forced-trigger workaround (#10279), strongly suggesting this report exposes a missing condition in that logic. The payload starts witheNq, indicating zlib-compressed JSON; I’ll decode it with Python and then compare the exact setter sequence against the current deduplication conditions. - Assistant
Python is absent, but the bundled utility exports the decoder. I’ll invoke it through Node to print the reproduction files.
- Assistant
The reproduction confirms a same-tick “set away, then restore” sequence:
v-modelfirst emits the browser’s raw value, then@inputrestores"a". Because the parent batches both assignments and ends at its prior value, it skips the child prop update;useModelalso sees the restored value equals its stale local prop and does not trigger, leaving Firefox’s DOM value unreconciled. I’ll inspect recent history/blame around the existing forced-update logic to preserve its intended deduplication semantics before patching. - Assistant
History confirms #11430 introduced
prevSetValuespecifically for multiple changes in one tick, but only ensured the second value was emitted; it did not force a child render when the second value restores the stale prop. I’ll inspect that commit’s test and patch to align this fix with the established scenario. - Assistant
I’ll make controlled-model detection reusable, then extend the forced-update condition for the distinct case where the latest emission restores
localValueafter a different prior emission. Guarding it to controlled models avoids redundant triggers for locally manageduseModelrefs. - Assistant
The second line-range edit shifted after the first edit, causing duplicated comment lines and dropping the two previous-value assignments. I caught this in the review output; I’ll replace the whole post-emit block atomically to restore those assignments and the intended logic.
- Assistant
The reviewed structure shows the replacement also consumed the setter’s
},line;git diff --checkcannot detect syntactic imbalance. I’ll restore the setter/object closures, then run formatting/type-aware checks immediately. - Assistant
The edit completed before the command timed out, but Corepack tried to prompt for a package-manager download. I’ll verify the file structure, then use the already-installed local binaries directly (or enable noninteractive Corepack if needed).
- Assistant
The syntax is now restored and local tool binaries are available. I’ll run Prettier/ESLint, then the focused
useModelunit suite to catch behavioral regressions in same-value suppression, transformers, local mode, and multiple same-tick assignments. - Assistant
The focused suite passes. To verify the exact reported sequence without adding or modifying repository tests, I’ll create a temporary standalone Vitest file under
/tmpthat uses Vue’s test renderer: it will simulate the raw input assignment followed by the restoring handler and assert the input is reset after the batched tick. I’ll first inspect the existing test imports/helpers so the temporary reproduction uses the same supported setup. - Assistant
Rather than creating a temporary test file (which the instructions prohibit), I’ll use a plain temporary script and run it with
vite-node, importing the source aliases through the repository config. The script will throw if the exact second-input reconciliation fails and will then be removed. - Assistant
vite-nodeis not installed, so the temporary script did not run and remains only under/tmp. I’ll remove it now. The focused test suite already exercises the same renderer and batching mechanism; next I’ll run the full runtime-core unit suite and TypeScript check, which provide broader verification without introducing tests. - Assistant
All 1,019 runtime-core unit tests pass. I’ll now run the repository TypeScript check and inspect the final diff/status for accidental files or unrelated changes.
- Assistant
TypeScript, formatting, lint, and diff checks are clean, with only
useModel.tsmodified. Since the visible symptom is DOM input reconciliation, I’ll also run the runtime-dom v-model directive suite to ensure the forced component update still interacts correctly with text inputs and composition handling. - Assistant
The DOM v-model suite also passes (28/28). Before submitting, I’ll perform one final status/diff check and verify there are no temporary artifacts. Then I’ll report each required checklist item explicitly and submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.