Skip to content

feat: add a search page for groups #3735

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

Merged
merged 35 commits into from
Jul 18, 2025
Merged

feat: add a search page for groups #3735

merged 35 commits into from
Jul 18, 2025

Conversation

lorenzo-cavazzi
Copy link
Member

@lorenzo-cavazzi lorenzo-cavazzi commented Jun 18, 2025

Work in progress

/deploy renku=lorenzo/groups-search

@RenkuBot
Copy link
Contributor

You can access the deployment of this PR at https://renku-ci-ui-3735.dev.renku.ch

@lorenzo-cavazzi lorenzo-cavazzi marked this pull request as ready for review June 27, 2025 15:45
@lorenzo-cavazzi lorenzo-cavazzi requested a review from a team as a code owner June 27, 2025 15:45
@leafty
Copy link
Member

leafty commented Jul 17, 2025

@lorenzo-cavazzi I would expect that all search pages use the same logic in the future. Having the logic in a redux slice makes that very easy to re-use in the different search pages. If we don't do that now, then we should document it so that we refactor the code for search to always use the same logic and components.

For reference:

  • Global search page -> should use the new search logic in the future
  • Group search page -> nice new search
  • User search page -> to be implemented

*/

import cx from "classnames";
import { useLayoutEffect } from "react";
Copy link
Member

Choose a reason for hiding this comment

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

Code smell: this is used for something that does not require layout attributes. It means the hook logic is probably buggy or that the hook doesn't implement correct cleanup.

Use useEffect() and update the hook if necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that using useLayoutEffect isn't the cleanest way to address the problem. I couldn't make useEffect work as expected in some corner cases, but perhaps the cleanest approach here is to drop useEffect and use React Router navigation synchronously.

Here are the changes a2b4214

@lorenzo-cavazzi
Copy link
Member Author

@leafty I fixed (hopefully) all the double-navigations cases and dropped useLayoutEffect. I added some notes about the components intended future

Comment on lines 97 to 101
onBlur={(e) => {
// Avoid triggering this on Enter key press by checking the target of the event
if (!(e.relatedTarget?.getAttribute("type") === "submit"))
handleSubmit((data) => onSubmit(data));
}}
Copy link
Member

Choose a reason for hiding this comment

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

This breaks the onBlur feature (searching when onBlur happens). In this case, let's just remove this handler entirely because it is an anti-pattern to do what the code is doing here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the fact that we search onBlur; if not, it would be best to reset the input when users click on filters to avoid confusion.
After reading more about why the onBlur behavior was overlapping with the submit, the trivial fix is to fall back to the form's submit explicitly instead of invoking the same function separately.
I changed that here c84b2e8

Copy link
Member

@leafty leafty left a comment

Choose a reason for hiding this comment

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

Otherwise should be OK to go.

@leafty
Copy link
Member

leafty commented Jul 18, 2025

weird behavior when switching entity types and the keywords are not shared:

Screen.Recording.2025-07-18.at.14.27.38.mov

leafty
leafty previously approved these changes Jul 18, 2025
Copy link
Member

@leafty leafty left a comment

Choose a reason for hiding this comment

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

LGTM

We can fix the issue above later if needed.

@lorenzo-cavazzi
Copy link
Member Author

@leafty since I was at it, I fixed the highlighting issue in e2cc503
I also fixed a tiny problem when updating keywords in projects -- if you dropped a keyword, no "update" was possible (see b46d49c).

Could you re-approve?

@lorenzo-cavazzi lorenzo-cavazzi merged commit 5b49d22 into main Jul 18, 2025
21 checks passed
@lorenzo-cavazzi lorenzo-cavazzi deleted the lorenzo/group-search branch July 18, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants