Skip to content

[Bug Report][3.8.8] VDataTableServer fires update:options twice when setting page to 1 on search #21555

@tlloydthwaites

Description

@tlloydthwaites

Environment

Vuetify Version: 3.8.8
Vue Version: 3.5.16
Browsers: Chrome 137.0.0.0
OS: Mac OS 10.15.7

Steps to reproduce

  • Create a VDataTableServer with bound search
  • Go to page 2
  • Enter a search 'x'
  • update:options will be fired with { page: 2, search: 'x' }
  • update:options will be fired with { page: 1, search: 'x' }

Expected Behavior

If options watcher is going to change the data, it should not fire the watcher twice.

Actual Behavior

It fires the watcher twice, which can lead to double load.

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

in VDataTable/composables/options.ts:38

    // Reset page when searching
    if (oldOptions && oldOptions.search !== value.search) {
      page.value = 1
      return; // <----- the above will fire the watcher again, so don't emit
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: VDataTableServerT: bugFunctionality that does not work as intended/expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions