-
Notifications
You must be signed in to change notification settings - Fork 214
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
Simplify media FetchState
and fix fetching errors
#5323
base: main
Are you sure you want to change the base?
Conversation
b31b1f9
to
af9a134
Compare
Latest k6 run output1
Footnotes
|
fda6fbe
to
467d6e1
Compare
Fixes #5322 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/WordPress/openverse/issues/5322?shareId=XXXX-XXXX-XXXX-XXXX).
467d6e1
to
aa359a0
Compare
FetchState
and fix fetching errors
3887eae
to
4507ed1
Compare
4507ed1
to
fe145ad
Compare
Full-stack documentation: https://docs.openverse.org/_preview/5323 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. |
24ceaf2
to
011fb6e
Compare
@@ -1,7 +1,7 @@ | |||
import type { StorybookConfig } from "@storybook-vue/nuxt" | |||
|
|||
const config: StorybookConfig = { | |||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | |||
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], |
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 don't have any .mdx
files, so Storybook was always printing warnings about this pattern.
@@ -95,6 +95,10 @@ export const AllCollections: Omit<Story, "args"> = { | |||
const mediaStore = useMediaStore() | |||
mediaStore.$patch({ | |||
results: { image: { count: 240 } }, | |||
mediaFetchState: { |
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 image count label is blank when the status is "idle" (the default value before fetching the media for the collection starts)
f6004ce
to
eed90eb
Compare
Fixes
Fixes #5322
Fixes #5325
Description
This PR replaces the flags used in
FetchState
with singlestatus
property, and an additionalerror
property. To prevent invalid states where status is noterror
, but there's error, the type uses TypeScript discriminated union.Some other changes:
fetchMedia
returns theResults
type that is a discriminated union (so, thetype
property determines the type of the items in theitems
list)canLoadMore
and i18n label computation out of the component to the parent components. This simplifies the component rendering in the Storybook.Testing instructions
Run the app using
ov just frontend/run dev
Search for "bamberg" and try the steps in #5325 - the errors from the issue should be fixed.
Fetching the media should work properly, both in the client and in SSR.
When the first page of results is loading on All media content, the content links should not say "No results", but should show "Loading..." label instead.
I tried creating a PR completely using the GitHub copilot, but I had to add a lot of changes on the first version: Copilot Workspace session.