-
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 fetchState
in the Nuxt app
#5322
Labels
💻 aspect: code
Concerns the software code in the repository
🧰 goal: internal improvement
Improvement that benefits maintainers, not users
🟨 priority: medium
Not blocking but should be addressed soon
🧱 stack: frontend
Related to the Nuxt frontend
Comments
obulat
added
💻 aspect: code
Concerns the software code in the repository
🟨 priority: medium
Not blocking but should be addressed soon
🧰 goal: internal improvement
Improvement that benefits maintainers, not users
🧱 stack: frontend
Related to the Nuxt frontend
labels
Jan 8, 2025
obulat
added a commit
that referenced
this issue
Jan 8, 2025
Fixes #5322 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/WordPress/openverse/issues/5322?shareId=XXXX-XXXX-XXXX-XXXX).
obulat
added a commit
that referenced
this issue
Jan 8, 2025
Fixes #5322 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/WordPress/openverse/issues/5322?shareId=XXXX-XXXX-XXXX-XXXX).
obulat
added a commit
that referenced
this issue
Jan 8, 2025
Fixes #5322 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/WordPress/openverse/issues/5322?shareId=XXXX-XXXX-XXXX-XXXX).
obulat
added a commit
that referenced
this issue
Jan 8, 2025
Fixes #5322 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/WordPress/openverse/issues/5322?shareId=XXXX-XXXX-XXXX-XXXX).
obulat
added a commit
that referenced
this issue
Jan 9, 2025
Fixes #5322 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/WordPress/openverse/issues/5322?shareId=XXXX-XXXX-XXXX-XXXX).
obulat
added a commit
that referenced
this issue
Jan 9, 2025
Fixes #5322 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/WordPress/openverse/issues/5322?shareId=XXXX-XXXX-XXXX-XXXX).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
💻 aspect: code
Concerns the software code in the repository
🧰 goal: internal improvement
Improvement that benefits maintainers, not users
🟨 priority: medium
Not blocking but should be addressed soon
🧱 stack: frontend
Related to the Nuxt frontend
Problem
The current structure of
fetchState
uses multiple flags (e.g.,isFetching
,hasStarted
,isFinished
,fetchingError
) to manage the state of API requests. This approach:isFinished: true
with a non-nullfetchingError
).Description
Refactor all
fetchState
objects to use a discriminated union, which explicitly defines possible states and ensures type safety. The new structure will look like this:Benefits
This change will apply to all instances of fetchState objects across the codebase.
Alternatives
Keep the Current Structure
Additional Context
Derived states (getters) for the UI
This change will also simplify the following common derived states:
canLoadMore
Determines whether to display the "Load More" button:
showLoadingSkeleton
Loading skeleton is only displayed for the first page being loaded. This getter will be used to determine whether to display it:
showNoResultsPage
Determines if the “No Results” page should be displayed:
Derived state for the store
To determine whether to send a request for the next page for specific media type, the following getter can be used:
The text was updated successfully, but these errors were encountered: