Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Convert media store to an options store #1260

Merged
merged 15 commits into from
Apr 14, 2022
Merged

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Apr 12, 2022

Fixes

Related to #1254 by @obulat
Fixes #1235 by @sarayourfriend

Description

This PR does two main things:

  1. converts media store to an options store to fix the server state hydration issues.
  2. Extracts the media-item state (for single image/audio pages).

The extraction of the media-item makes it possible to re-use the media item information from the search results on the single media detail page, instead of fetching it every time, even when we already have this data in the store.
It also refactors the single image detail page to get the media data in the asyncData.

Testing Instructions

The media store is the backbone of the app state, so all of these critical paths could be affected, and should not have any problems after this PR:
Searching for audio/image from homepage, search page and content pages on server-rendered (opened URL directly) and client-rendered (opened by following an internal link) pages.
Server-rendered search pages (All Content, image and audio) with no results, with fewer than 20 results and with more than 20 results should be interactive (at the minimum, you should be able to click on the content switcher and change the search type.
Clicking on "Load more".
Selecting a filter and deselecting it, or going back using the browser back button.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@obulat obulat added 🟧 priority: high Stalls work on the project or its dependents 💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users labels Apr 12, 2022
@obulat obulat requested a review from a team as a code owner April 12, 2022 10:27
@obulat obulat requested review from krysal and dhruvkb April 12, 2022 10:27
src/pages/image/_id.vue Outdated Show resolved Hide resolved
src/pages/image/_id.vue Outdated Show resolved Hide resolved
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work well! I tested thoroughly and am still just running into the same bugs I found earlier today. Once these are all merged it'll be easier to tell what needs to be fixed still.

test/unit/specs/stores/media-item-store.spec.js Outdated Show resolved Hide resolved
src/stores/media/media-item.ts Outdated Show resolved Hide resolved
src/stores/media/media-item.ts Outdated Show resolved Hide resolved
src/stores/media/media-item.ts Outdated Show resolved Hide resolved
src/stores/media/index.ts Outdated Show resolved Hide resolved
src/stores/media/index.ts Outdated Show resolved Hide resolved
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@sarayourfriend
Copy link
Contributor

This branch appears to fix the load more crashing the SSR audio results page as well 🙂 http://localhost:8443/search/audio?q=galah on this branch does not crash.

@obulat obulat merged commit b52e0b4 into main Apr 14, 2022
@obulat obulat deleted the pinia_media_options_store branch April 14, 2022 09:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟧 priority: high Stalls work on the project or its dependents
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audio search result page non-interactive if there are fewer than 20 results
3 participants