-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix(SavedSearch): Force user to validate criteria before saved search #18385
base: 10.0/bugfixes
Are you sure you want to change the base?
Conversation
Awaiting user feedback |
js/modules/Search/GenericView.js
Outdated
}); | ||
bs_modal.show(); | ||
|
||
if (window.location.search.includes('reset=reset') || window.location.search.trim() === '') { |
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 am not sure that this condition will match all problematic cases.
A solution could be to rebuild the expected parameters based on the current criteria form values instead of relying on window.location.search
. It is probably simple to do as this computation is probably already done on the JS side.
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.
If the user does not check the criteria (press the search button before save), window.location.search
is empty.
I can't see how to rebuild the expected parameters based on the current values in the criteria form.
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.
Building the query params for the search is already handled in the refreshResults
function of Table.js
.
However, this isn't intuitive UX. When you create a bookmark in a browser for example, it is for the page you are on, not the page you are typing in the address bar but haven't navigated to yet. In Firefox, they even hide the bookmark button when you are typing in the address bar.
Simply disabling the button to create a saved search when there are unsaved changes, and having a helpful tooltip on it, should be sufficient. Then when the results refresh, the button gets re-enabled.
Checklist before requesting a review
Please delete options that are not relevant.
Description
Perhaps an alternative to #18376.
After further review, I believe the issue here is that the saved search system expects the user to execute a search based on their criteria at least once (to include them in the URL).
See
GenericView.js L102
If the user does not execute a search at least once, the default search for the item type is used and saved in the database.
Since I don’t see how to extract the search
convert it into a URL as shown here
and then pass it to the modal (from
GenericView.js L102
)I simply propose checking whether
window.location.search
is not empty or does not correspond to a search reset (reset=reset
).Screenshots (if appropriate):