bcgov / entity

ServiceBC Registry Team working on Legal Entities
Apache License 2.0
23 stars 58 forks source link

UIs: fix "deprecated native modifier on v-on directive" (Vue3 MUST FIX) #14355

Open severinbeauvais opened 1 year ago

severinbeauvais commented 1 year ago

Example:

warning: '.native' modifier on 'v-on' directive is deprecated (vue/no-deprecated-v-on-native-modifier) at src/views/Dashboard.vue:150:26:
  148 |                   v-if="!isHistorical"
  149 |                   :disabled="hasBlocker || !isAllowed(AllowableActions.VIEW_CHANGE_COMPANY_INFO)"
> 150 |                   @click.native.stop="goToChangeFiling()"
      |                          ^
  151 |                 >
  152 |                   <v-icon small>mdi-pencil</v-icon>
  153 |                   <span>Change</span>

Ref: https://eslint.vuejs.org/rules/no-deprecated-v-on-native-modifier.html

Ref: https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html

severinbeauvais commented 1 year ago

I don't know how to fix this so it needs to be researched and then fixed in code for all projects that have this issue, including:

  1. Create UI
  2. Edit UI
  3. Filings UI
  4. Namerequest UI
  5. BCRS Shared Components
  6. Auth Web

^^ If the above cannot be done within the estimate of this ticket then please create new ticket(s).

leodube-aot commented 1 year ago

The .native modifier is not deprecated in Vue2 however the linter is throwing warnings for using it because we are using some Vue 3 features. We will need to remove .native modifiers as part of the migration to Vue 3 (see: https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html). The fix should be as simple as removing the modifier without any extra changes. I tried this in a couple existing repos that are still on Vue 2 with mixed success. Removing the .native modifier in Vue 2 mostly worked as expected but I ran into a few cases where the “click” event was not getting registered. Rather than do a partial fix I will move this back into the backlog to be completed as part of the Vue 3 migration. If the linter warnings become annoying we can always ignore the rule.

severinbeauvais commented 1 year ago

Excellent analysis and reporting. I agree with your recommendations. Thanks!