-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b2f70ed
Properly notmalize empty query string. This fixes an error where goin…
linuspahl 0cbf198
Properly update view and execute new search when URL query oparams ch…
linuspahl a6568be
Avoid executing search twice when using browser navigation.
linuspahl dc5884b
Properly update browser history when creating a new search.
linuspahl 627b665
Ignore order of query params when comparing Uris.
linuspahl 62bb1c0
Rever change that caused query input to be empty on replay search page.
linuspahl 592df8f
Udpate tests
linuspahl ea43277
Extend tests
linuspahl ee556f3
Improve tests
linuspahl e6b3453
Adding changelog
linuspahl 90bbcab
Merge branch 'master' into issue-22105
linuspahl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| type = "f" | ||
| message = "Fix browser navigation not restoring the previous search" | ||
|
|
||
| issues = ["22105", "18484"] | ||
| pulls = ["24583"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,6 @@ import isDeepEqual from 'stores/isDeepEqual'; | |
| import type { ViewHook, ViewHookArguments } from 'views/logic/hooks/ViewHook'; | ||
| import View from 'views/logic/views/View'; | ||
| import normalizeSearchURLQueryParams from 'views/logic/NormalizeSearchURLQueryParams'; | ||
| import createSearch from 'views/logic/slices/createSearch'; | ||
|
|
||
| const bindSearchParamsFromQuery: ViewHook = async ({ query, view, executionState }: ViewHookArguments) => { | ||
| if (view.type !== View.Type.Search) { | ||
|
|
@@ -68,11 +67,8 @@ const bindSearchParamsFromQuery: ViewHook = async ({ query, view, executionState | |
| return [view, executionState]; | ||
| } | ||
|
|
||
| const newSearch = view.search.toBuilder().newId().queries([newQuery]).build(); | ||
|
|
||
| const savedSearch = await createSearch(newSearch); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are now calling |
||
|
|
||
| const newView = view.toBuilder().search(savedSearch).build(); | ||
| const newSearch = view.search.toBuilder().queries([newQuery]).build(); | ||
| const newView = view.toBuilder().search(newSearch).build(); | ||
|
|
||
| return [newView, executionState]; | ||
| }; | ||
|
|
||
152 changes: 0 additions & 152 deletions
152
graylog2-web-interface/src/views/hooks/SyncWithQueryParameters.test.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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
updateViewalso executes a new search and creates a new entry in the undo / redo stack.