Skip to content
TheChatArchiveThe Chat Archive
MiniMaxminimax/minimax-m3· unknownHugging 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. MiniMax Assistant

    I'll analyze the issue carefully. The problem is about defineModel not working correctly in Firefox, but works in Chrome. Let me start by exploring the repository structure.

  3. MiniMax Assistant

    This is the Vue.js core repository. Let me explore the structure of packages.

  4. MiniMax Assistant

    Let me look at the useModel function in the helpers:

  5. MiniMax Assistant

    Now let me look at the playground link content to understand the example. Let me look at the encoded part:

  6. MiniMax Assistant

    Now I understand the issue. Looking at the reproduction:

    <!-- Comp.vue -->
    <script setup lang="ts">
    const model = defineModel()
    
    function onInput(event: Event) {
      let modifiedValue = 'a'
      model.value = modifiedValue
    }
    </script>
    
    <template>
      <input v-model="model" @input="onInput" />
    </template>
    
    <!-- App.vue -->
    <script setup lang="ts">
    import { ref} from 'vue'
    import Comp from './Comp.vue';
    
    const amount = ref('')
    </script>
    
    <template>
      <Comp v-model="amount"/>
    </template>
    

    So the user enters something in the input field, the onInput handler runs which sets model.value = 'a', and the model is bound to the input via v-model. The user expects that only "a" should remain.

    The issue is in useModel (the implementation of defineModel). Looking at it again:

    set(value) {
      const emittedValue = options.set ? options.set(value) : value
      if (
        !hasChanged(emittedValue, localValue) &&
        !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))
      ) {
        return
      }
      const rawProps = i.vnode!.props
      if (
        !(
          rawProps &&
          // check if parent has passed v-model
          (name in rawProps ||
            camelizedName in rawProps ||
            hyphenatedName in rawProps) &&
          (`onUpdate:${name}` in rawProps ||
            `onUpdate:${camelizedName}` in rawProps ||
            `onUpdate:${hyphenatedName}` in rawProps)
        )
      ) {
        // no v-model, local update
        localValue = value
        trigger()
      }
    
      i.emit(`update:${name}`, emittedValue)
      // #10279: if the local value is converted via a setter but the value
      // emitted to parent was the same, the parent will not trigger any
      // updates and there will be no prop sync. However the local input state
      // may be out of sync, so we need to force an update here.
      if (
        hasChanged(value, emittedValue) &&
        hasChanged(value, prevSetValue) &&
        !hasChanged(emittedValue, prevEmittedValue)
      ) {
        trigger()
      }
      prevSetValue = value
      prevEmittedValue = emittedValue
    },
    

    Let's trace through what happens when the user types "abc":

    1. The input fires "input" event with value "abc"
    2. The v-model="model" updates model.value = 'abc'
    3. In the setter, value = 'abc', emittedValue = 'abc', no options.set
    4. Check: hasChanged('abc', '') is true (initial empty value), so doesn't return early
    5. i.emit('update:modelValue', 'abc')
    6. Parent receives the update, sets amount.value = 'abc'
    7. The watchSyncEffect in the customRef fires because props.modelValue changed to 'abc'
    8. Now localValue = 'abc', trigger is called
    9. Now @input handler runs, sets model.value = 'a'
    10. In setter: value = 'a', emittedValue = 'a'
    11. hasChanged('a', 'abc') is true (current localValue is 'abc')
    12. Wait... but at this point, the @input handler runs after v-model has set model.value = 'abc'. So localValue should be 'abc'. But maybe in Firefox, the order is different?

    Let me re-look at the <input v-model="model" @input="onInput" />. In Vue, when you do v-model="model", it compiles to:

    :value="model" 
    @input="model.value = $event.target.value"
    

    Wait, but in Vue 3, v-model compiles to :modelValue="model" and @update:modelValue="model = $event". Since model is a ref, the compiler would use model.value = $event as the update handler.

    Actually, looking at the v-model directive compilation for the input element, it should compile to:

    <input :value="model" @input="$event => model = $event.target.value">
    

    Where model is the ref. So when the user types, the input event fires, and Vue calls the update handler which sets model.value = .... Then, the @input="onInput" also fires (or fires before).

    Hmm, the order matters here. Let's look at the input event listeners. In Vue, when you bind multiple handlers to an event using v-model and @input, the order is:

    1. First, the v-model handler (because it's compiled first into the template)
    2. Then, the explicit @input handler

    Wait, actually, looking at Vue's compiler:

    • v-model="model" compiles to :modelValue (or :value) and @update:modelValue (or @input)
    • If you add @input="onInput" to the same element, both should fire

    Actually, the order of event handlers might depend on how Vue compiles the template. Let me check.

    Actually, looking at this more carefully:

    • <input v-model="model" @input="onInput" />

    When you use v-model on a regular <input>, Vue compiles it as:

    • :value="model" and @input="model = $event.target.value"

    (For text inputs, v-model is mapped to value prop and input event, not modelValue/update:modelValue.)

    So in this case:

    1. User types something (e.g. "abc")
    2. The native input event fires
    3. Both listeners are called: a. model = $event.target.value → sets model.value = 'abc' b. onInput($event) → sets model.value = 'a'

    The order matters! In Chrome, maybe order a comes first, in Firefox order b comes first?

    Actually, looking at Vue's behavior:

    • All event handlers attached via @ are called in the order they appear in the template
    • But for v-model, the binding is internal

    Let me think about this. The compiled template might be:

    h('input', {
      value: model.value,
      'onUpdate:modelValue': $event => model.value = $event,
      // OR
      onInput: $event => model.value = $event.target.value,
      onInput: onInput
    })
    

    Wait, v-model on <input> compiles to value and onUpdate:modelValue for components, but for native input, it compiles to value and onInput (or just DOM eventproperties).

    Let me check the compiler to understand:

  7. MiniMax Assistant

    Now let me look at how Vue patches elements and processes directives to understand the order:

  8. MiniMax Assistant

    Let me look at the renderer mountElement to understand the order of operations:

  9. MiniMax Assistant

    Let me look at watchSyncEffect:

  10. MiniMax Assistant

    Let me look at the v-model compiler for native inputs:

  11. MiniMax Assistant

    Let me check what happens when both onUpdate:modelValue and onInput are present on the element:

  12. MiniMax Assistant

    So onUpdate:modelValue is not a reserved prop, so it would be patched. Let me check what happens:

    Looking at runtime-dom/src/patchProp.ts:

  13. MiniMax Assistant

    Let me search for existing tests for useModel:

  14. MiniMax Assistant

    Let me look at the watch implementation to understand watchSyncEffect:

  15. MiniMax Assistant

    OK, so flush === 'sync' means there's no scheduler, and the effect runs immediately. Let me see what that means for props.

    Let me check baseWatch:

  16. MiniMax Assistant

    Let me actually try to reproduce this issue with a test script:

  17. MiniMax Assistant

    Let me look at how to run the tests:

  18. MiniMax Assistant

    Let me write a test script that simulates the issue:

  19. MiniMax Assistant

    OK defineModel is a compile-time macro. Letme use useModel directly:

  20. MiniMax Assistant

    Let me look at how props are updated:

  21. MiniMax Assistant

    Let me search for related GitHub issues or PRs in the code:

  22. MiniMax Assistant

    Let me check the most recent commit related to v-model andactiveElement:

  23. MiniMax Assistant

    Wait, let me re-read the beforeUpdate code carefully:

  24. MiniMax Assistant

    Let me re-run the test with more debugging to understand the flow:

  25. MiniMax Assistant

    Let me fix the test to include the proper compiled output:

  26. MiniMax Assistant

    Let me add logging to the useModel to trace the issue:

  27. MiniMax Assistant

    Let me modify useModel to add debug logging:

  28. MiniMax Assistant

    Let me check how props are made reactive:

  29. MiniMax Assistant

    The test isn't quite reproducing the issue. The parent doesn't track amount reactively in my test. Let me fix this:

  30. MiniMax Assistant

    Wait, my test now passes! The issue I created was in my test setup. Let me restore the original useModel and verify:

  31. MiniMax Assistant

    Let me search for any code that handles this kind of issue:

  32. MiniMax Assistant

    Let me look at the recent commits and CHANGELOG to understand the issue:

  33. MiniMax Assistant

    Let me check the changelog for recent changes related to this:

  34. MiniMax Assistant

    Let me look at the vModelText directive and the test that already exists:

  35. MiniMax Assistant

    Let me search for any tests related to Firefox or input value behavior:

  36. MiniMax Assistant

    Let me look at the git log for vModel.ts:

  37. MiniMax Assistant

    Let me look at the fix for issue #8546 and #2302:

  38. MiniMax Assistant

    Let me look at the fix for #8547:

  39. MiniMax Assistant

    Let me check the GitHub issue tracker or related PRs more systematically:

  40. MiniMax Assistant

    Let me check the issue more carefully by searching for related code:

  41. MiniMax Assistant

    Let me try compiling the actual template to see the output:

  42. MiniMax Assistant

    Let me use vitest with a simpler test to compile the template:

  43. MiniMax Assistant

    Let me look at the createElement function in runtime-dom:

  44. MiniMax Assistant

    Let me check the useModel at the time of Vue 3.5.17:

  45. MiniMax Assistant

    The useModel is the same as the current code. So the issue must be in vModelText or somewhere else.

    Let me check the vModelText at 3.5.17:

  46. MiniMax Assistant

    Let me check the issue tracker by searching for related comments in code:

  47. MiniMax Assistant

    Let me write a more comprehensive test that simulates multiple input events (which is what happens when a user types multiple characters):

  48. MiniMax Assistant

    Now I understand the bug! Let me trace through the issue:

    When the user types 'abc' character by character:

    1. Type 'a': DOM='a', model='a' (via onInput)
    2. Type 'b' (DOM becomes 'ab'): v-model listener sets model='ab', emit. Then onInput sets model='a', emit. Parent receives 'a' (same as current parent amount). Parent doesn't re-render (value didn't change from parent's perspective). Child doesn't re-render. DOM stays 'ab'.
    3. Type 'c' (DOM becomes 'abc'): Same issue, DOM stays 'abc'.

    The DOM is out of sync because the child doesn't re-render when the parent's value is the same as before. Let me look at the existing trigger logic and propose a fix:

  49. MiniMax Assistant

    Let me verify the bug and try a fix. First, let me look at the full useModel code one more time:

  50. MiniMax Assistant

    Now I understand the bug. Let me make a fix. The cleanest fix is to trigger the customRef at the end of the setter, which will notify the render effect, causing the child component to re-render. This will ensure vModelText's beforeUpdate is called to sync the DOM.

    Let me apply the fix:

  51. MiniMax Assistant

    Let me apply the fix. The issue is that the child doesn't re-render when the parent's prop is the same as before, even though the DOM is out of sync. I'll trigger the customRef in the setter to force a re-render.

    Let me first verify my understanding by writing a test that demonstrates the issue is fixed:

  52. MiniMax Assistant

    Let me apply the fix. I'll trigger the customRef in the setter to ensure the child re-renders and the DOM is updated:

  53. MiniMax Assistant

    The fix works! Now after typing 'abc', the DOM is correctly 'a'. Let me run all the existing tests to make sure I didn't break anything:

  54. MiniMax Assistant

    My fix is too aggressive. It causes extra re-renders. Let me look at the failing tests:

  55. MiniMax Assistant

    I see, my fix is too aggressive. Let me revert it and apply a more targeted fix:

  56. MiniMax Assistant

    Now let me apply a more targeted fix that only triggers when needed:

  57. MiniMax Assistant

    All existing useModel tests pass. Let me verify the bug is fixed:

  58. MiniMax Assistant

    Let me run all the related tests to ensure nothing is broken:

  59. MiniMax Assistant

    All tests pass. Let me also run the vue package tests to be safe:

  60. MiniMax Assistant

    Now let me clean up my test file before submitting:

  61. MiniMax Assistant

    Let me run all the tests one final time to make sure everything works:

  62. MiniMax Assistant

    All tests pass. Let me verify the final fix:

  63. MiniMax Assistant

    Let me verify the fix one more time with a comprehensive test:

  64. MiniMax Assistant

    The fix works correctly. Let me clean up the test file:

  65. MiniMax Assistant

    Let me verify the final state of useModel.ts:

  66. MiniMax Assistant

    Let me also run a broader test to make sure nothing else is broken:

  67. MiniMax Assistant

    All tests pass. Let me provide a summary of the work:

    Summary

    Issue

    defineModel doesn't work correctly on Firefox when using v-model with an @input handler that resets the value. When a user types characters (e.g., "abc") in an input field with <input v-model="model" @input="onInput" /> where onInput sets model.value = 'a', the input should display 'a' but instead shows the typed value.

    Root Cause

    When the user types multiple characters, the input event fires for each character. For each character:

    1. v-model listener calls model.value = <typed value> (e.g., 'ab')
    2. @input listener calls model.value = 'a'
    3. Both emit update:modelValue to parent

    The parent's value ends up being 'a' (same as the initial value), so the parent doesn't re-render the child with a new prop. The child's shouldUpdateComponent returns false, so the child component doesn't re-render. As a result, vModelText's beforeUpdate hook doesn't run, and the DOM stays at the typed value (e.g., 'abc') instead of being updated to 'a'.

    Fix

    Added an else if branch to the setter in useModel.ts that triggers the customRef when the emitted value equals the current parent prop value. This forces the child component's render effect to run, which calls vModelText's beforeUpdate hook to update the DOM.

    The condition !hasChanged(emittedValue, props[camelizedName]) ensures we only trigger when:

    • The setter is emitting a value
    • The emitted value is the same as the parent's current prop value (meaning the parent won't re-render in a way that updates the child)

    This is complementary to the existing #10279 trigger condition (which handles the transformer case). The else if ensures we don't trigger twice.

    Checklist

    • If an error was reported in the issue description, I have successfully reproduced it. - Reproduced the bug using a test that simulates user typing character by character.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error. - After applying the fix, the test shows input.value: "a" after typing 'abc', which is the expected behavior.
    • I have thought about edge cases and made sure my fix handles them as well. - Tested:
      • The original kebab-case tests (no unnecessary re-renders)
      • The #10279 force local update test (existing behavior preserved)
      • The parent limiting child value test
      • Cases where the value is the same as before (handled by early return)
      • Cases where the parent re-renders correctly (handled by parent's update mechanism)
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. - All 1451+ tests pass across runtime-core, runtime-dom, vue, vue-compat, and reactivity packages.
  68. MiniMax Assistant

    The fix is minimal and focused - only 10 lines added to packages/runtime-core/src/helpers/useModel.ts. Let me submit:

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