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

Use the VMediaCollection for search and collection results #3835

Merged
merged 9 commits into from Mar 19, 2024

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Feb 27, 2024

Fixes

Based on #3831
Fixes #3884 by @obulat
Fixes #3576 by @AetherUnbound
Fixes #3830 by @obulat

Initially, I split the changes into the search result and collection result changes. However, this made it more difficult to understand the scope and changes, and to test the PRs. This is why I merged the collection changes (as well as the deletion of the now-unused components) into this PR.

Description

This PR fixes the collection result fetching and improves the fetching of the search results.

It uses the new VMediaCollection component and 2 new components for the search and collection results.

  • VSearchResults component fills in the components necessary for search results: search title and content links in the header, load more button, and the external search form in the footer.
  • VCollectionResults component adds the components necessary for collection results: VCollectionHeader and load more button.

The media fetching was updated: now it is done in a single place: search.vue and collection.vue, instead of being split among these pages, middleware and the Load more component. This allows us to handle fetching, refetching, and loading more items from the same place. The "Load more" button now only handles sending the Analytics events.

Testing Instructions

Run the app with additional_search_views on.
Check that the search results are updated correctly: when the search term is updated, search type is changed, filters are updated or load more button is clicked. The result labels should be updated correctly, loading skeletons shown when media is fetching for the first time, media should be updated for the correct query.
The same check needs to be done for collection pages

The search results should be updated correctly when the additional_search_views is off.

Repeat the instructions from #3884 and see that the problem is fixed and results are refreshed

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate 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.
  • I ran the DAG documentation generator (if applicable).

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.

@github-actions github-actions bot added the 🧱 stack: frontend Related to the Nuxt frontend label Feb 27, 2024
@openverse-bot openverse-bot added the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label Feb 27, 2024
@obulat obulat mentioned this pull request Feb 27, 2024
8 tasks
@obulat obulat added 🟨 priority: medium Not blocking but should be addressed soon 🧰 goal: internal improvement Improvement that benefits maintainers, not users 💻 aspect: code Concerns the software code in the repository and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Feb 27, 2024
@obulat obulat changed the base branch from main to refactor/collection-pages February 27, 2024 12:59
@obulat obulat changed the base branch from refactor/collection-pages to refactor/combine-related-media March 2, 2024 05:17
@obulat obulat force-pushed the refactor/search-results branch 3 times, most recently from 01c709c to 7b790d8 Compare March 2, 2024 09:35
@obulat obulat force-pushed the refactor/combine-related-media branch from 519cfee to fd3a46d Compare March 3, 2024 13:01
Base automatically changed from refactor/combine-related-media to main March 6, 2024 16:02
@obulat obulat self-assigned this Mar 7, 2024
@openverse-bot openverse-bot added the 🕹 aspect: interface Concerns end-users' experience with the software label Mar 7, 2024
@obulat obulat marked this pull request as ready for review March 7, 2024 16:22
@obulat obulat requested a review from a team as a code owner March 7, 2024 16:22
@obulat obulat requested review from zackkrida and dhruvkb March 7, 2024 16:22
@obulat obulat force-pushed the refactor/search-results branch 3 times, most recently from 3db9e99 to 5e7c35a Compare March 14, 2024 17:40
@openverse-bot

This comment has been minimized.

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.

Before I dive too deeply into the code I am seeing two bugs. Let me know if this PR is the right place to address these; if not, I am happy to ignore them and re-review!

  1. There is a regression where the placeholder "skeleton" UI isn't shown when switching media types via the content switcher.
  2. When navigating to a source collection from a creator collection, the results are not re-fetched.

@obulat
Copy link
Contributor Author

obulat commented Mar 15, 2024

1. There is a regression where the placeholder "skeleton" UI isn't shown when switching media types via the content switcher.

This should be addressed in this PR

2. When navigating to a source collection from a creator collection, the results are not re-fetched.

Should be fixed in #3886

I'm going to draft this PR to address the first point.

@obulat obulat changed the title Use the VMediaCollection for search result for a better code organization Use the VMediaCollection for search and collection results Mar 15, 2024
@obulat
Copy link
Contributor Author

obulat commented Mar 16, 2024

1. There is a regression where the placeholder "skeleton" UI isn't shown when switching media types via the content switcher.

It turns out there were too many mediaStore.clearMedia calls, which removed the existing media in the store while also resetting the fetch state. So, fetchSingleMedia would set isFetching to true, and then it would immediately be reset to false by another call (when switching type or in the search.vue route watcher).
I audited the clearMedia calls and removed unnecessary ones.

2. When navigating to a source collection from a creator collection, the results are not re-fetched.

When I first started implementing this PR, we had no "source" link button on the creator page, so there was no way of navigating from one collection to another. You could only navigate from a collection to a single result. That's why I didn't even test this scenario.
To fix, I added a route watcher similar to the one in the search.vue component that fetches the media if the route changes.

@obulat obulat force-pushed the refactor/search-results branch 3 times, most recently from e264994 to 07088d5 Compare March 17, 2024 04:46
@obulat obulat removed the 🕹 aspect: interface Concerns end-users' experience with the software label Mar 17, 2024
@obulat obulat marked this pull request as ready for review March 17, 2024 10:50
@obulat obulat requested a review from zackkrida March 17, 2024 10:50
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.

This LGTM with the caveat that there's a typo in the translation paths which I have outlined here. I will pre-approve though since that's only a typo. Everything is behaving well.

Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
Handle fetching in `collection.vue` page, and replace `VCollectionPage` with `VCollectionResults`

Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
Signed-off-by: Olga Bulat <obulat@gmail.com>
Copy link

Full-stack documentation: https://docs.openverse.org/_preview/3835

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.

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

LGTM!

@obulat obulat merged commit fc38553 into main Mar 19, 2024
40 checks passed
@obulat obulat deleted the refactor/search-results branch March 19, 2024 17:23
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
Projects
Archived in project
4 participants