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
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 callsubmit) usinggit statusor 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
Let me start by understanding the issue. The issue is about
defineModelon Firefox not working as expected. This is a Vue.js core repository, and the issue is about v-model / defineModel behavior in Firefox.Let me first explore the repository structure and understand what we're dealing with. Then I'll look at the reproduction link to understand the exact problem.
Let me start by exploring the repository structure and finding relevant files related to
defineModeland v-model.Assistant
This is the Vue.js core repository. Let me look at the packages directory to understand the structure better.
Assistant
Let me look at the runtime-dom package for v-model related code, and also search for defineModel:
Assistant
Let me look at the key file - the runtime-dom vModel directive, which handles the actual DOM-level v-model implementation
Assistant
Let me use the correct parameter name for
opencommand.Assistant
Let me scroll down to see the rest of the file.
Assistant
Let me scroll further down and also look at the e2e tests.
Assistant
Let me also look at the e2e test and the useModel helper
Assistant
Let me look at the useModel helper and the e2e test.
Assistant
Let me look at the e2e vModel test and the existing tests.
Assistant
Let me search for recent commits related to Firefox or compositionstart/end that might be related to this issue.
Assistant
Let me look at the defineModel implementation and related
Assistant
Let me look at the runtime-dom tests for vModel to understand the test setup.
Assistant
Let me search for Firefox or composition-related issues in the codebase
Assistant
Let me search for recent changes related to v-model and defineModel specifically
Assistant
Let me look at some relevant commits that might be related to this
Assistant
Let me look at this commit more carefully.
Assistant
Let me decode the playground link to understand
Assistant
Let me try another approach to decode the playground link.
Assistant
Let me search for known Firefox input event timing issues in the codebase
Assistant
Let me look at the vModel composition test
Assistant
Let me look at the composition session test
Assistant
Let me create a reproduction script to understand
Assistant
Let me run the repro
Assistant
Let me fix
Assistant
Let me look at recent relevant commits about v-model and input
Assistant
Let me look at the commits about defineModel updates
Assistant
Let me look at this commit
Assistant
Let me look at the current useModel.ts
Assistant
Let me search for the specific issue numbers referenced in commits
Assistant
Let me look at the defineModel test in compiler-sfc
Assistant
Let me find the test with
setoptionAssistant
Let me look at the get/set transformers test
Assistant
Let me look at the useModel tests
Assistant
Let me search for the set option test in useModel tests
Assistant
Let me look at the custom setter test
Assistant
Let me look at the force local update test
Assistant
Let me check the current version
Assistant
Let me look at how v-model is compiled with defineModel
Assistant
Let me look at how v-model is compiled in compiler
Assistant
Let me create a test to reproduce
Assistant
Let me run the existing vModel tests
Assistant
Let me also run the useModel tests
Assistant
Let me look at the releases after 3.5.17
Assistant
Let me look at the #8546 fix more closely
Assistant
Let me look at the commit for #8546/#8547
Assistant
Let me look at this commit
Assistant
Let me search for Firefox or related issues in git log
Assistant
Let me create a proper test to reproduce the issue
Assistant
Now I have a good understanding of the issue. Let me look at the
useModel.tssetter more carefully. The bug is in the early return condition in thesetfunction. WhenprevSetValueisEMPTY_OBJ(first set) and the setter transforms the value to the same aslocalValue, the function returns early without emitting or triggering a re-render. This means the DOM never gets corrected.Let me verify by looking at the condition:
Assistant
Now I understand the bug. The early return condition in
useModel.tsset function at line 60-66 has a flaw. WhenprevSetValueisEMPTY_OBJ(first time setting) and the setter transforms the value to equallocalValue, the function returns early without emitting, andprevSetValuenever gets updated fromEMPTY_OBJ. This means subsequent changes that also get transformed to equallocalValuealso return early, and the DOM never gets corrected.The fix: when
prevSetValueisEMPTY_OBJ, we should comparevalueagainstlocalValueinstead, because there's no previous set value to compare against.Let me implement this
Assistant
Let me use replace with the multi-line syntax
Assistant
Now let me run the existing tests to make sure nothing is broken.
Assistant
All tests pass. Let me also run the vModel tests and the compiler-sfc defineModel tests
Assistant
Let me also check the vModel compiler transform to understand the interaction
Assistant
Let me look at how the compiler handles v-model on elements
Assistant
Let me look at the core vModel transform more carefully
Assistant
Let me look at the vModel transform
Assistant
Let me run a broader test suite to make sure the fix doesn't break anything
Assistant
Let me also run the compiler-dom vModel tests and the vue e2e tests
Assistant
Let me also check if there's any other place in vModel that could cause Firefox issues - specifically looking at how the
beforeUpdatehandles the DOM updateAssistant
Let me run the full test suite to make sure nothing is broken
Assistant
The only failures are e2e tests that need a browser (puppeteer), which is expected in this environment. All unit tests pass (3569 tests). Let me verify my change one more time.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.