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 on Firefox. - Assistant
Let me decode the reproduction and find the
defineModelimplementation. - Assistant
Python3 is not available. Let me try node.
- Assistant
Let me try gunzipSync instead.
- Assistant
Maybe it's inflate rather than gunzip. The base64 starts with eNq which is typical for zlib deflate with raw or with header.
- Assistant
I'll inspect the
defineModeland v-model implementation next, and look for any Firefox-specific history. - Assistant
Let me look at the vModelText directive carefully - that's where the issue like "value not updating when assignment is the same" typically happens, and there were Firefox-specific quirks.
- Assistant
Let me read the rest of beforeUpdate
- Assistant
I'll check how event listeners are ordered for v-model versus
@input. - Assistant
Let me search git history and changelogs for related fixes.
- Assistant
Let me inspect related defineModel fixes and how
_assigningis used. - Assistant
Let me look for similar Firefox v-model issues and check current useModel implementation.
- Assistant
Let me look at commit b1be9bd64 which prevent unnecessary DOM update from v-model - that might have introduced the Firefox bug.
- Assistant
Let me check how templates are compiled when both v-model and @input are present.
- Assistant
I'll inspect the mount order for directive hooks versus event props.
- Assistant
Let me look at mountElement more carefully around lines 654-750
- Assistant
Let me check the "multiple changes in same tick" fix more carefully.
- Assistant
Let me check component update skipping when props are unchanged.
- Assistant
Let me read shouldUpdateComponent fully
- Assistant
Let me search for related GitHub issues and any recent PRs that match this.
- Assistant
Let me inspect defineModel compilation and the existing tests.
- Assistant
I'll write a temporary reproduction that mirrors the issue.
- Assistant
I'll craft a temporary test that reproduces the reported behavior.
- Assistant
Let me run the test
- Assistant
Vitest might be in watch mode by default — I'll switch to run mode.
- Assistant
Something is hanging. Let me check vitest config.
- Assistant
Corepack is trying to download pnpm and hanging. Let me use the vitest binary directly.
- Assistant
The bug is reproduced: when the parent model ends unchanged, the child never re-renders so the input DOM stays dirty. I'll fix
useModelto force a local update in that case. - Assistant
I'll update
useModelso it forces a local re-render when the emitted value matches the current local value. - Assistant
prevEmittedValue is now unused — I'll remove it to avoid lint errors.
- Assistant
Next I'll run the reproduction and the existing useModel tests.
- Assistant
Repro passes. Now run useModel unit tests.
- Assistant
The #10279 test fails. Let me look at it carefully.
- Assistant
I'll check how
hasChangedtreats numeric2versus string'2'. - Assistant
Let me read hasChanged
- Assistant
I'll combine both force-update conditions so the
#10279case still works. - Assistant
That edit landed in the wrong file — I'll restore
general.tsand apply the change touseModel.ts. - Assistant
Restored
general.ts. Next I'll apply the fix carefully with--file. - Assistant
Looks good. Let me also clean up a typo in comments "willad" was fixed.Verify general.ts is clean and run tests.
- Assistant
All tests passed. I'll remove the temporary reproduction and run a wider set of related tests.
- Assistant
I'll review the final diff, then submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.