Conversation
Storybook and Tailwind configuration previews: Ready Storybook: https://wordpress.github.io/openverse-frontend/_preview/1635 Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again. You can check the GitHub pages deployment action list to see the current status of the deployments. |
Size Change: -10.3 kB (-1%) Total Size: 767 kB
ℹ️ View Unchanged
|
package.json
Outdated
"eslint-plugin-vuejs-accessibility": "^1.1.1", | ||
"husky": "^7.0.1", | ||
"jest": "^26.6.3", | ||
"jest-transform-stub": "^2.0.0", | ||
"lint-staged": "^12.3.7", | ||
"module-alias": "^2.2.2", | ||
"npm-run-all": "^4.1.5", | ||
"pinia": "^2.0.11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We apparently had pinia
both in dependencies and devDependencies, with somewhat different versions specified.
test/playwright/utils/breakpoints.ts
Outdated
return expect( | ||
await screenshotAble.screenshot(options) | ||
).toMatchSnapshot({ | ||
test.describe(`screen at breakpoint ${breakpoint} with width ${screenWidth}`, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, this was re-formatted by the linter. The main change in this file is the type of ExpectSnapshot, which was throwing an error.
9380070
to
c0a567d
Compare
dc7ce73
to
d174ac2
Compare
@@ -70,13 +70,13 @@ export default defineComponent({ | |||
</script> | |||
|
|||
<style scoped> | |||
::v-deep .attribution { | |||
::v-deep(.attribution) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warning in #1634 starts appearing with the update to Vue 2.7, so I just fixed it here.
I managed to fix the playwright issue in #1646 (comment). One line fix to be able to update Playwright and avoid having to pin it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I have a couple minor questions.
src/composables/use-focus-on-show.js
Outdated
ensureFocus(dialog, { preventScroll: true, isActive }) | ||
if (dialog.tabIndex === undefined || dialog.tabIndex < 0) { | ||
warn(noFocusableElementWarning) | ||
Vue.nextTick(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nextTick
is available from the composition API. What is the reason to pull it off of Vue
directly rather than importing it from @nuxtjs/composition-api
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main advantage of importing it from Vue is that when we (hopefully, some time in the future) move to Nuxt3, we won't need to update the imports. Other than that, there is no reason, really. Do you think it makes sense to use @nuxtjs/composition-api? At least for consistency with the current state of the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for consistency it makes sense. When (if) we move away from it, it will mostly be a find-and-replace job to update that import, right?
src/stores/feature-flag.ts
Outdated
for (const flagEntry of Object.entries(this.flags)) { | ||
const [name, flag] = flagEntry as [string, FeatureFlag] | ||
if (getFlagStatus(flag) === SWITCHABLE) { | ||
flag.preferredState = cookies[name] | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a change to appease TypeScript?
I don't remember if this is still the case, but at one point using a for...of
loop actually incurred a non-trivial size penalty due to the generator runtime transpilation of it. Might not be an issue any more though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's TS appeasing change. I didn't know about for ... of performance. I think I can improve this code by typing this
typings/csstype/index.d.ts
Outdated
@@ -1,3 +1,4 @@ | |||
import type * as CSS from 'csstype' // eslint-disable-line @typescript-eslint/no-unused-vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this import for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an error without it, I'll have to look it up at my computer tomorrow. It's also how module augmentation is done in the csstype docs (the third point here): https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. Can you add a link to the docs you shared here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vue-tsc
gives the following error when we don't have the import:
src/components/VAudioTrack/layouts/VBoxLayout.vue(2,18): error TS2322: Type '{ width: string | undefined; }' is not assignable to type 'StyleValue | undefined'.
Object literal may only specify known properties, and 'width' does not exist in type 'CSSProperties | StyleValue[]'.
src/components/VSkeleton/VAudioTrackSkeleton.vue(16,23): error TS2322: Type '{ width: string; }' is not assignable to type 'StyleValue | undefined'.
Object literal may only specify known properties, and 'width' does not exist in type 'CSSProperties | StyleValue[]'.
src/components/VAudioTrack/VWaveform.vue(94,17): error TS2322: Type '{ width: string; left: string; }' is not assignable to type 'StyleValue | undefined'.
Object literal may only specify known properties, and 'width' does not exist in type 'CSSProperties | StyleValue[]'.
I guess without the import it considers that CSSProperties
type only has the properties that are in the typings/csstype/index.d.ts
instead of augmenting it...
d34f706
to
a2a0450
Compare
It looks like even with the pinned Playwright version there are still lots of visual regression tests 😕 |
I think I've found the issue. The dev version was working fine, but when you ran |
test/playwright/utils/navigation.ts
Outdated
@@ -248,7 +248,7 @@ export const goToSearchTerm = async ( | |||
page.waitForNavigation(), | |||
page.click(`[aria-label="${t('search.search', dir)}"]`), | |||
]) | |||
await page.waitForLoadState('networkidle') | |||
await page.waitForLoadState('domcontentloaded') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the tests faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much faster indeed. I'm not sure 100% we should use domcontentloaded
over load
because load
also downloads stylesheets and images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, we should use load
to make sure that all the images are there for the snapshots. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this branch locally and found nothing behaving abnormally. I see no reason to block this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Exciting!
Description
This PR updates Vue to version 2.7 which backports the composition API to Vue 2. This should (hopefully) make the future conversion to Nuxt 3 easier.
The main updated packages are Vue (to version 2.7) and
@nuxtjs/composition-api
which supports Vue 2.7 (0.33.1).Other changes:
vue-loader
added to devDependencies to force the ^15.10 version as described in Vue 2.7 update post.Problems that I encountered:
node_modules/.bin
directory and symlinks no longer being created after upgrading from v6 to v8 npm/cli#4308)Testing Instructions
The CI tests should pass. The app should behave as normal everywhere.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin