-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix browser navigation not restoring the previous search. #24538
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
…g back to a search qithout a query string, did not update the view.
…ange. For example when using the browser navigation.
|
|
||
| if (newView !== view) { | ||
| return dispatch(updateView(newView, true)); | ||
| } |
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 change is required to update the reflux store with the new view which contains the changes URL query params.
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.
Calling updateView also executes a new search and creates a new entry in the undo / redo stack.
|
|
||
| const newSearch = view.search.toBuilder().newId().queries([newQuery]).build(); | ||
|
|
||
| const savedSearch = await createSearch(newSearch); |
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.
Since we are now calling updateView in bindSearchParamsFromQueryThunk we don't need to call it here anymore.
dennisoelkers
left a comment
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.
Looks good and works well!
* Properly notmalize empty query string. This fixes an error where going back to a search qithout a query string, did not update the view. * Properly update view and execute new search when URL query oparams change. For example when using the browser navigation. * Avoid executing search twice when using browser navigation. * Properly update browser history when creating a new search. * Ignore order of query params when comparing Uris. * Rever change that caused query input to be empty on replay search page. * Udpate tests * Extend tests * Improve tests * Adding changelog (cherry picked from commit a8bcfe7)
* Properly notmalize empty query string. This fixes an error where going back to a search qithout a query string, did not update the view. * Properly update view and execute new search when URL query oparams change. For example when using the browser navigation. * Avoid executing search twice when using browser navigation. * Properly update browser history when creating a new search. * Ignore order of query params when comparing Uris. * Rever change that caused query input to be empty on replay search page. * Udpate tests * Extend tests * Improve tests * Adding changelog (cherry picked from commit a8bcfe7)
* Properly notmalize empty query string. This fixes an error where going back to a search qithout a query string, did not update the view. * Properly update view and execute new search when URL query oparams change. For example when using the browser navigation. * Avoid executing search twice when using browser navigation. * Properly update browser history when creating a new search. * Ignore order of query params when comparing Uris. * Rever change that caused query input to be empty on replay search page. * Udpate tests * Extend tests * Improve tests * Adding changelog (cherry picked from commit a8bcfe7)
…24636) * Properly notmalize empty query string. This fixes an error where going back to a search qithout a query string, did not update the view. * Properly update view and execute new search when URL query oparams change. For example when using the browser navigation. * Avoid executing search twice when using browser navigation. * Properly update browser history when creating a new search. * Ignore order of query params when comparing Uris. * Rever change that caused query input to be empty on replay search page. * Udpate tests * Extend tests * Improve tests * Adding changelog (cherry picked from commit a8bcfe7) Co-authored-by: Linus Pahl <[email protected]>
…24637) * Properly notmalize empty query string. This fixes an error where going back to a search qithout a query string, did not update the view. * Properly update view and execute new search when URL query oparams change. For example when using the browser navigation. * Avoid executing search twice when using browser navigation. * Properly update browser history when creating a new search. * Ignore order of query params when comparing Uris. * Rever change that caused query input to be empty on replay search page. * Udpate tests * Extend tests * Improve tests * Adding changelog (cherry picked from commit a8bcfe7) Co-authored-by: Linus Pahl <[email protected]>
…4638) * Fix browser navigation not restoring the previous search. (#24538) * Properly notmalize empty query string. This fixes an error where going back to a search qithout a query string, did not update the view. * Properly update view and execute new search when URL query oparams change. For example when using the browser navigation. * Avoid executing search twice when using browser navigation. * Properly update browser history when creating a new search. * Ignore order of query params when comparing Uris. * Rever change that caused query input to be empty on replay search page. * Udpate tests * Extend tests * Improve tests * Adding changelog (cherry picked from commit a8bcfe7) * Update import path --------- Co-authored-by: Linus Pahl <[email protected]> Co-authored-by: Linus Pahl <[email protected]>
Please note, this PR needs to be backported.
Description
Motivation and Context
As described in #22105 and #18484 there are currently multiple issues with using the browser navigation.
These issues are mostly related to the following circumstances:
history.pushandhistory.replaceare being called when opening the search pagehistory.pushis called twice when using the browser navigationThis PR improves when
hisroty.pushandhistory.replaceare being called. Please note there is one issue #24539 left which needs to be addressed in a follow-up PR because it requires more fundamental changes.Fixes #22105
Fixes #18484