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
System: 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
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto 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 with Firefox. - Assistant
Let me look at the reproduction code and find defineModel-related source code.
- Assistant
Let me examine defineModel implementation and related v-model handling for inputs.
- Assistant
Let me look at useModel helper and vModel directive more carefully.
- Assistant
Let me check the changelog and related commits for Firefox / defineModel issues.
- Assistant
Let me look at the useModel tests for #10279 and recent commits related to this.
- Assistant
python3 not found, try node
- Assistant
Let me check how v-model and @input event order is compiled, and look for related issues/PRs.
- Assistant
Let me check how event listeners are ordered/patched for
@inputvs v-model. - Assistant
Let me check how v-model is compiled for native inputs vs component usage.
- Assistant
Let me look at the snapshot for simple expression
- Assistant
Let me check when directive created hooks vs event props get applied.
- Assistant
Let me read the full mountElement function carefully.
- Assistant
This might be prop change skipping — let me check how component updates check props.
- Assistant
Let me read shouldUpdateComponent fully
- Assistant
Let me review the history of the useModel set logic and related GitHub issues.
- Assistant
Let me write a test to reproduce the issue with defineModel and overwriting the valueon input.
- Assistant
Let me create a temporary test to reproduce the issue.
- Assistant
Let me put the test in the proper location and run it.
- Assistant
The test timed out. Let me try running vitest more directly.
- Assistant
Just a serialization format issue. Let me fix the test expectations.
- Assistant
The serialization adds quotes. Let me fix the assertions properly.
- Assistant
Let me review the #11430 test and related edge cases more carefully.
- Assistant
The test 'parent limiting child value' looks very relevant to this issue.
- Assistant
Let me check fix #11656 and whether
beforeUpdatemight skip resetting values incorrectly. - Assistant
I've confirmed the bug: when
defineModelis set back to the same value after an intermediate change, the child doesn't re-render so the DOM stays stale. Let me implement the fix. - Assistant
I'll generalize the force-local-update condition so DOM stays in sync when the emitted value matches the current local value.
- Assistant
prevEmittedValueis now unused — I'll remove it. - Assistant
Now let me run the reproduction test and existing useModel tests.
- Assistant
The #10279 test fails due to string/number mismatch. Let me inspect the test more carefully.
- Assistant
Let me debug how msg becomes number 2 in the #10279 test.
- Assistant
There was a quote error. Let me fix.
- Assistant
There's number-modifier coercion at emit time — let me find that.
- Assistant
Let me check the full emit modifier handling.
- Assistant
I'll compare against the modifier-processed emitted value so it matches what the parent actually receives.
- Assistant
Need to go to line 1 first or use --file
- Assistant
I need to navigate to the top of the file first.
- Assistant
I'll restore
prevEmittedValueand combine both force-update conditions — simpler than reimplementing modifier coercion. - Assistant
Let me run the tests again.
- Assistant
All tests pass. Let me clean up temp files and run a broader test suite. Also let me verify the defineModel +
:valuefilter pattern works. - Assistant
runtime-dom directives didn't run — checking the path.
- Assistant
runtime-dom is excluded from the unit project — checking vitest config for the right project.
- Assistant
Let me create a jsdom reproduction matching the original issue and run the vModel tests.
- Assistant
Let me write a jsdom test for the exact reproduction from the issue.
- Assistant
The DOM reproduction passes. Let me clean up and run the full vModel test suite.
- Assistant
Let me review the final diff and also verify the early-return path still handles the "same value" case correctly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.