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

Jump to Vue 3 #551

Merged
merged 1 commit into from
Mar 10, 2022
Merged

Jump to Vue 3 #551

merged 1 commit into from
Mar 10, 2022

Conversation

micgro42
Copy link
Collaborator

@micgro42 micgro42 commented Mar 4, 2022

The components build now successfully, tests pass and storybook works.

The Message component is still missing. It was accidentally removed as part of #534 and will be added back in an extra PR after this one is merged.

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

@micgro42
Copy link
Collaborator Author

micgro42 commented Mar 7, 2022

This is now green, except for the visual regression tests, but strangely, they seem to have caught something somewhat real? The little whitespace that used to be between components is now gone. o.O

@micgro42 micgro42 marked this pull request as ready for review March 9, 2022 10:31
@micgro42 micgro42 force-pushed the next-jumpToVue3 branch 4 times, most recently from 11054df to 1558156 Compare March 10, 2022 11:23
@micgro42 micgro42 changed the title WIP jump to vue 3 Jump to Vue 3 Mar 10, 2022
This is a single big commit that migrates all the components in the next
branch to Vue 3.

With the options API, there were a lot of error of typescript not
understanding where props are coming from when they were used in
methods. It is unclear why that is, but it can be fixed by moving the code to
script setup. Therefore that was done for the Button and the Lookup
components.

A further consideration is that Vue 3 now renders comments (at least in
development mode) and so it breaks some tests that expects a single
root.

The tests of the LookupInput in particular needed some more work:

* Vue.nextTick is now nextTick
* disabled is now always the empty string if present
* .native has been removed
** the native focus event has to be triggered on the actual HTML element

Also, many more wrapper methods are now async so that we can just await them
instead of having to wait for nextTick explicitly. This means that
nextTick is no longer needed in the Lookup tests.

A lot of the tests produced confusing typescript errors. The root cause
of these mysterious errors turned out to actually be that we were still
using the propsData key. Apparently that is deprecated when using
javascript tests, but breaks hard when typescript is used.

The tests in LookupCore.spec.ts specifically need also the change to
src/shims-vue.d.ts to work, the others don't.

Also there is a change in Vue3 in how the whitespace coming from
newlines in the template between tags is handled. This affects us
insofar as some of the whitespace we saw in storybook is now gone.
This is fixed by adding a compiler option to those stories. This
generally doesn't affect production because there we are not relying on
that whitespace from newlines in the template, but rather create
whitespace via CSS where we want it.

Also, using props in the storybook stories to work with the Controls
Storybook addon somehow stopped working. So some stories were changed to
inject the args into the `data` option instead.

The comments for the LookupInput events are moving to the same events in
Lookup component, so that they actually show up in storybook.

Typescript also validates that the values given to props match the
excepted types. Though I saw these errors only in my IDE so far, not yet
in the actual type check during npm run build.

Bug: T303503
@micgro42
Copy link
Collaborator Author

Let me know if there are any questions that are not answered in the commit message.

@micgro42
Copy link
Collaborator Author

the two any types in production code will be replaced in a follow-up PR

@micgro42 micgro42 merged commit 01e727b into next Mar 10, 2022
@micgro42 micgro42 deleted the next-jumpToVue3 branch March 10, 2022 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants