Skip to content

Vue3 upgrade: vue-debounce-decorator #13853

Closed

Description

@severinbeauvais

Investigate/identify:

  • whether we can use this library in Vue3
  • what is missing to be able to use it (or when it will be available)
  • alternate packages (or whether we can change our code as needed)
  • what if we stop using this package altogether?

Activity

  1. lambert-alex commented on Oct 7, 2022

    @lambert-alex

    Vue 3 implementation in search-ui

    Screenshot 2022-10-07 151610.png

  2. severinbeauvais commented on Jul 11, 2023

    @severinbeauvais
    CollaboratorAuthor

    I came across this in a shared component. vue-debounce-decorator no longer worked with Vue 2.7.

    Old:

    import { Debounce } from 'vue-debounce-decorator'
    
    /**
       * Called when prop changes (ie, v-model is updated by parent).
       * This method is debounced to prevent excessive validation.
       */
    @Watch('value')
    @Debounce(300)
    private onValueChanged (val: string): void {
      this.emitValid(val)
    }
    

    New:

    import { debounce } from 'lodash'
    
    /**
       * Called when prop changes (ie, v-model is updated by parent).
       * This method is debounced to prevent excessive validation.
       */
    @Watch('value')
    private onValueChanged (val) {
      this.onValueChangedDebounced(val)
    }
    
    private onValueChangedDebounced = debounce((val: string) => {
      this.emitValid(val)
    }, 300)
    

    Since we have a working solution, I'm closing this ticket.

  3. severinbeauvais commented on Jul 20, 2023

    @severinbeauvais
    CollaboratorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ENTITY - DO NOT USE

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions