Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VAutocomplete): Reliably unregister list items when filtering #20603

Closed
wants to merge 1 commit into from

Conversation

J-Sek
Copy link
Contributor

@J-Sek J-Sek commented Oct 21, 2024

Description

TODO:

  • avoid regression in VCombobox

fixes #20516

Markup:

<template>
  <v-app>
    <v-container>
      <h5>VAutocomplete</h5>
      <v-autocomplete :items="items" />
      <h5>VCombobox</h5>
      <v-combobox :items="items" />
      <pre>
Scenario 1:
- type: tt
- press (slowly): {backspace}{backspace}

Scenario 2:
- type: rrr
- press (slowly): {backspace}{backspace}{backspace}

Scenario 3:
- type: ww
- press (slowly): {backspace}{backspace}
      </pre>
    </v-container>
  </v-app>
</template>

<script setup>
  const items = [
    { title: 'Atis', value: 'atis' },
    { title: 'Banana', value: 'banana' },
    { title: 'Cranberry', value: 'cranberry' },
    { title: 'Durian', value: 'durian' },
    { title: 'Pineapple', value: 'pineapple' },
    { title: 'Strawberry', value: 'strawberry' },
  ]
</script>

@J-Sek J-Sek marked this pull request as ready for review October 21, 2024 14:06
@J-Sek J-Sek force-pushed the fix/20516 branch 2 times, most recently from 6497746 to afa37ce Compare October 21, 2024 19:25
if (options?.forRegisteredNodes) {
// list items must be unmounted to reliably unregister
filteredItems.value = []
filteredMatches.value = new Map()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary if the items are keyed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this block you will observe warnings upon typing t. I have added console logs to make it clear what happens.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok we just need to make sure unregister is always called first.

Copy link
Contributor Author

@J-Sek J-Sek Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you would like an alternative where Virtual Scroll takes over the nested items resolution.

@MajesticPotatoe MajesticPotatoe changed the title fix(nested): Reliably unregister list items when filtering fix(VAutocomplete): Reliably unregister list items when filtering Oct 28, 2024
@MajesticPotatoe MajesticPotatoe added T: bug Functionality that does not work as intended/expected C: VAutocomplete VAutocomplete labels Oct 28, 2024
@J-Sek J-Sek self-assigned this Dec 3, 2024
@J-Sek J-Sek requested a review from KaelWD December 3, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VAutocomplete VAutocomplete T: bug Functionality that does not work as intended/expected
Projects
None yet
3 participants