Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION defineModel on Firefox does not work as expected Vue version 3.5.17…

  1. User

    ISSUE DESCRIPTION

    defineModel on Firefox does not work as expected

    Vue version

    3.5.17

    Link to minimal reproduction

    https://play.vuejs.org/#eNqFUslOwzAQ/RXLlxSppAc4lRaxqIcisQgQJ1+idBJcnLHlJVSq8u+MnbYUynKy573xm+eZWfNLY/I2AB/ziSutNJ458MEwVWA9Fdw7wc8FysZo69maWag6VlndsIxeZTvmWjdmg+ejGETR7EygwFKj86xodEDPplFhkGVHAiejviDJU+ChMarwQBFjkyTXHjd6AYpc9I8FHxE7Ge2l8iE5pAKVrPOl00jfWEcBwUtSkArsvfGSDAg+ZomJXKGUfr9JmLcBhlu8fIXy7Qd86VYRE/zBggPbguA7zhe2BrIW6dnTHazoviPJf1CU/Qf5CE6rED32aVcBF2R7Ly+5nac2S6yf3WzlAd32U9FozOxSvuDU9ti8377+afckP03vBHbUxe3I/tmDfpZpLDTKBVQS4TZGAxqowCpgGWsyjXM0wQ+gBfRjNovHUe9CQRKQlYTFS6ECkFBW0CaxXjdvN+CXJHL5bWMOdkbGintLk07B2UUiCNiYIuhwj7oPe2AHrg

    Steps to reproduce

    1. Use firefox
    2. 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.4
    

    Any 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 using git reset --hard command. Additionally, you can use git stash and git stash pop 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 submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /core, current file: none) bash-$

  2. Claude Assistant

    Good, jsdom-based tests using vitest. Let's create a temporary test to reproduce the scenario.

  3. Claude Assistant

    Need to use require alternative - import useModel directly instead of require.

  4. Claude Assistant

    Now let's run the repro test and the full useModel test suite plus vModel directive tests.

  5. Claude Assistant

    Repro test passes now. Let's run the full useModel test suite and other related tests.

  6. Claude Assistant

    Now run the tests again.

  7. Claude Assistant

    All tests pass now. Let's run the broader runtime-core and runtime-dom test suites to make sure nothing else broke.

  8. Claude Assistant

    All tests pass. Let's also run the compiler-sfc / full test suite for related areas (defineModel compiler-sfc tests) to be thorough, then clean up.

  9. Claude Assistant

    Now let's remove the temporary repro test file and run the full test suite once more as a final sanity check.

  10. Claude Assistant

    This diff looks clean and minimal. Now let's re-verify the full useModel + runtime-dom + runtime-core suites once more (without the repro file) and also check type-checking passes.

  11. Claude Assistant

    All pass. Let's also run type-check to make sure TS compiles cleanly for this file.

  12. Claude Assistant

    Type-checking passes cleanly. Let's do a final review of the complete modified file for correctness and clean formatting.

  13. Claude Assistant

    This looks good. Let's run lint/format check to ensure style conformance.

  14. Claude Assistant

    Both ESLint and Prettier pass cleanly. Now let's do a final full test run of the whole repo (or at least a broad relevant subset) to be extra sure.

  15. Claude Assistant

    Confirmed - both failures are pre-existing environment issues (no sandbox for puppeteer as root, and a flaky perf-timing test), unrelated to my change. This confirms my fix doesn't introduce any regressions.

  16. Claude Assistant

    Summary

    Root cause analysis: The issue reproduction (defineModel + v-model + an additional native @input handler that resets the model value) revealed a real, browser-independent race condition in useModel()'s underlying customRef.

    When a v-model-bound model ref is set multiple times within the same tick (e.g., once by the internal vModelText directive listener with the raw typed value, and again by a user's own @input handler that overrides it back to a fixed value), and the final emitted value happens to equal the value the local model already had before this tick started, the watchSyncEffect that syncs props[camelizedName] back into localValue never detects a change (since the prop round-trips back to the same value). Because of this, trigger() is never called, the component's render effect never re-runs, and therefore vModelText's beforeUpdate DOM-correction logic (which forces el.value back in sync) never executes — leaving the native <input> element's DOM value out of sync with the actual model value. This differs across browsers only in how visibly/likely this race manifests (timing/dispatch quirks), but the underlying logic bug is deterministic and reproducible in jsdom as well.

    Fix: In packages/runtime-core/src/helpers/useModel.ts, extended the existing "force local update" logic (previously only handling the #10279 setter-conversion edge case) to also cover the no-setter case: when a value is set multiple times in the same tick and the final emitted value equals the pre-tick localValue (so the prop-sync watcher won't fire), we now force a trigger() so the component's render effect always re-runs and reconciles the DOM/local rendering with the actual model state.

    Verification:

    • Wrote a temporary reproduction test simulating the exact scenario from the issue (v-model + overriding @input handler) — confirmed it failed before the fix (input.value stuck at 'ab' instead of 'a') and passes after.
    • Ran the full useModel test suite, runtime-dom/runtime-core test suites, and compiler-sfc defineModel tests — all pass.
    • Ran tsc --noEmit, ESLint, and Prettier — all clean.
    • Ran the full repo test suite; only pre-existing environment-related failures remain (puppeteer e2e tests fail due to no sandbox as root, and one flaky perf-timing test), confirmed identical on a clean checkout without my changes.
    • Removed the temporary reproduction test file before submitting.
  17. Claude Assistant

    Checklist review

    • If an error was reported in the issue description, I have successfully reproduced it. Yes — I decoded the SFC playground reproduction, rebuilt it as a jsdom-based vitest test simulating defineModel() + v-model + an overriding @input handler, and confirmed that input.value incorrectly stayed at 'ab' instead of resetting to 'a', matching the reported browser symptom.

    • If an error was reported in the issue description, I have confirmed that my fix resolves the error. Yes — after patching useModel.ts to force a local trigger() when a model value is set multiple times in the same tick and round-trips back to its pre-tick value, the reproduction test passes (input.value correctly becomes 'a').

    • I have thought about edge cases and made sure my fix handles them as well. Yes — I carefully preserved the existing #10279 setter-conversion forced-update behavior (verified via existing test force local update when setter formats value to the same value), verified the new condition doesn't fire on the very first set() call (prevSetValue !== EMPTY_OBJ guard), and confirmed kebab-case / non-syncing-parent scenarios still avoid unnecessary re-renders.

    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. Yes — ran useModel.spec.ts, all of runtime-core and runtime-dom unit tests, compiler-sfc defineModel tests, tsc --noEmit, ESLint, and Prettier — all pass. Ran the full repo test suite; the only failures are pre-existing environment issues (puppeteer sandbox restrictions under root, and one flaky performance-timing test), verified to fail identically without my change applied.

  18. Claude Assistant

    The fix has been implemented and verified. Let me do one final confirmation that everything is in order before submitting.

  19. Claude Assistant

    Good, the change is clean and only touches the relevant file. No leftover temporary test files. Let's submit.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.