-
Notifications
You must be signed in to change notification settings - Fork 6
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
[#8661] Add 'Save Profile' button #5930
Conversation
7ab79e0
to
ecfa444
Compare
e8cafd3
to
1da11fe
Compare
|
||
useEffect(() => { | ||
const handlePopState = () => { | ||
window.location.reload() |
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 ensures the page is reloaded if browser back/forward.
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.
Why does it need that?
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.
Without the hard refresh, if a user clicks back/forward based on a history push state, we'd need to obtain the previous client side state for the previous page which is pretty complex!
Another option is we don't use push state to change the search-profile
in the URL at all, so on successful save of search profile we do a hard refresh with the new search profile id, but from a user perspective it would be slower and maybe not as seamless. But yeah, less code complexity with this option.
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.
how about using replaceState
instead? Or am I misunderstanding you?
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.
Using replaceState
wouldn't cause a page refresh when using back/forward, which is what we need to force to reload the searchProfile for the page with the selected filters.
For example:
- On load, the page URL is
projects?search-profile=1
- User interacts with filter again
- User saves search profile and window.history updates the URL to
projects?search-profile=2
- If the user then clicks back or forward, the client side state of the url would change to the original
projects?search-profile=1
, but the state of the filters and the whole page would not update to reflect this.
1da11fe
to
36d5bc8
Compare
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.
Thank you for this good PR! Would you mind checking the comments I left you?
meinberlin/assets/scss/components_user_facing/_search-profiles.scss
Outdated
Show resolved
Hide resolved
meinberlin/assets/scss/components_user_facing/_search-profiles.scss
Outdated
Show resolved
Hide resolved
projectStatus | ||
}) | ||
|
||
const name = generateName({ ...results, search: appliedFilters.search }) |
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 thought the name is generated by the backend?
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.
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 thought the name is generated by the backend?
@vellip Oh, that's good to know: I had no idea. Shall I wait for that to merged? Then we can remove this functionality.
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.
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.
Whoops, looks like when I force pushed after merging dev
it closed this PR 🤷♂️. I've created a new comment about name generation in the new PR: #5940 (comment)
|
||
useEffect(() => { | ||
const handlePopState = () => { | ||
window.location.reload() |
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.
Why does it need that?
79f3b00
to
4ab0601
Compare
4ab0601
to
dfc79c4
Compare
Oh weird, I have no idea why this closed due to force pushing 🤷♂️, I've created a new one: #5940 |
Describe your changes
This PR adds the "Save Search Profile" button.
Tasks