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

Replace compact-input & labeled-form-element with composables #11491

Open
rak-phillip opened this issue Jul 18, 2024 · 0 comments
Open

Replace compact-input & labeled-form-element with composables #11491

rak-phillip opened this issue Jul 18, 2024 · 0 comments
Labels
kind/tech-debt Technical debt QA/dev-automation Issues that engineers have written automation around so QA doesn't have look at this

Comments

@rak-phillip
Copy link
Member

The existing compact-input & labeled-form-element mixins were translated to composables named useCompactInput & useLabeledFormElement as a means to proof out the concept of using composables and to resolve issues with TypeScript compatibility when migrating from Vue.extend to defineComponent().

Not all mixin usages were replaced, resulting in divergence between the original mixins and their replacement composables.

Proposed solution

Update useCompactInput & useLabeledFormElement to ensure feature parity with existing mixins.

Replace the compact-input & labeled-form-element mixins with their respective composables in:

  • shell/components/form/LabeledSelect.vue

Replace the labeled-form-element mixin with its respective composable in:

  • shell/components/form/InputWithSelect.vue
  • shell/components/form/LabeledSelect.vue
  • shell/components/form/Select.vue
  • shell/components/form/ServiceNameSelect.vue

Remove the compact-input & labeled-form-element mixins from Dashboard entirely.

Additional Information

Benefits of using composables over mixins:

TypeScript Support

Composables offer better TypeScript support and leverage static typing and autocompletion out of the box without requiring additional developer intervention.

Simple Unit Testing

Composables are functions that return reactive objects, making them much easier to unit test. Unit tests can be written by importing and calling the composable function without instantiating a Vue component.

Examples:

  • shell/composables/useCompactInput.test.ts
  • shell/composables/useLabeledFormElement.test.ts
  • shell/composables/useUserRetentionValidation.test.ts
@github-actions github-actions bot added the QA/dev-automation Issues that engineers have written automation around so QA doesn't have look at this label Jul 18, 2024
@rak-phillip rak-phillip added the kind/tech-debt Technical debt label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/tech-debt Technical debt QA/dev-automation Issues that engineers have written automation around so QA doesn't have look at this
Projects
None yet
Development

No branches or pull requests

1 participant