-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
You can access the deployment of this PR at https://renku-ci-ui-3735.dev.renku.ch |
80416b0
to
7472019
Compare
7d14cee
to
b8e6cac
Compare
@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:
|
*/ | ||
|
||
import cx from "classnames"; | ||
import { useLayoutEffect } from "react"; |
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.
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.
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.
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
@leafty I fixed (hopefully) all the double-navigations cases and dropped |
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)); | ||
}} |
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.
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.
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.
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
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.
Otherwise should be OK to go.
weird behavior when switching entity types and the keywords are not shared: Screen.Recording.2025-07-18.at.14.27.38.mov |
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.
LGTM
We can fix the issue above later if needed.
Work in progress
/deploy renku=lorenzo/groups-search