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
Interface
No new interfaces are introduced.
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 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 start by exploring the repository structure and understanding the
defineModelissue on Firefox. - Assistant
Let me look at the reproduction more carefully. The issue is about defineModel on Firefox. Let me decode the playground link mentally - it's about v-model with defineModel where they try to restrict t...
- Assistant
rg is not found, let me use grep instead.
- Assistant
Let me examine the defineModel runtime implementation and related v-model input handling.
- Assistant
Let me read the useModel helper and the related v-model DOM handling.
- Assistant
Let me decode the playground reproduction to understand the exact failing case.
- Assistant
Python isn't available; I'll decode the playground payload with Node instead.
- Assistant
This looks like a race/order issue between the v-model update and the custom
@inputhandler on Firefox/Chrome. I'll inspect how native input v-model and event merging work. - Assistant
Let me read the vModel directive carefully.
- Assistant
Let me read the rest of beforeUpdate
- Assistant
I'll search the changelog and related tests/commits for this known Firefox/defineModel case.
- Assistant
There's already a related test for forcing local updates when the setter keeps the same value. Let me read those tests.
- Assistant
Let me inspect how the compiler emits native v-model plus an
@inputlistener. - Assistant
Let me read the vModel transform and see how it works with @input.
- Assistant
Next I'll check event listener registration order and how
valueis patched on inputs. - Assistant
I'll verify the mount order of DOM props versus directives — that controls which input listener runs first.
- Assistant
Let me look at mountElement more carefully around lines 666-750
- Assistant
Let me check the git history of useModel to understand the intended behavior.
- Assistant
Let me look at PR #11430 which is about multiple changesاف in same tick - that's very related!
- Assistant
I’ll check for related branches or recent discussions, then validate the force-local-update fix with a quick reproduction.
- Assistant
I've identified the issue: when
defineModelsets a value that matches the current prop, no re-render happens so the input DOM stays stale. I'll write a reproduction and apply the force-local-update fix. - Assistant
I'll implement the fix and verify it with a temporary reproduction of the issue scenario.
- Assistant
The replace failed because maybe whitespace issues. Let me try edit with line numbers.
- Assistant
Running existing useModel tests and a temporary reproduction for this scenario.
- Assistant
The command timed out. Let me try with npx vitest or check how tests are run.
- Assistant
Let me try running vitest with a longer approach - maybe without piping.
- Assistant
The #10279 test failed unexpectedly — I'll debug why the force update isn't triggering a re-render.
- Assistant
The test expects a numeric
2— there may be number-modifier conversion on emit. Checking that path. - Assistant
Let me read the number modifier part
- Assistant
The number modifier coerces emit args, so
localValuecan be2whileemittedValueis'2'. I'll combine both force-update conditions. - Assistant
The edit was applied to the wrong file — I'll restore
componentEmits.tsand apply the change touseModel.ts. - Assistant
Good, componentEmits is restored and I'm on the right file. Now let me apply the correct combined fix.
- Assistant
Good. Now let me run the tests again and also create a reproduction of the issue scenario.
- Assistant
All existing tests pass. Next I'll temporarily reproduce the reported scenario to confirm the fix.
- Assistant
I'll fix the import path to match the existing useModel specs.
- Assistant
The file got corrupted because I only replaced the first 20 lines but the structure was broken. Let me rewrite the whole file.
- Assistant
Quoting differs for string values — I'll update the assertions to match.
- Assistant
Reproduction passes. Removing the temporary test and verifying the final diff.
- Assistant
Confirming the repro fails without the fix, so we know we fixed the right bug.
- Assistant
Confirmed the bug without the fix. Restoring the fix and cleaning up.
- Assistant
I'll also run the v-model/runtime-dom tests to make sure nothing else regressed.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.