-
-
Couldn't load subscription status.
- Fork 4.6k
fix: Fix clearing unified search when modal is closed #53964
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
danxuliu
merged 2 commits into
master
from
fix-clearing-unified-search-when-modal-is-closed
Jul 17, 2025
Merged
fix: Fix clearing unified search when modal is closed #53964
danxuliu
merged 2 commits into
master
from
fix-clearing-unified-search-when-modal-is-closed
Jul 17, 2025
Conversation
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
|
/backport to stable31 |
|
/backport to stable30 |
aa94c02 to
a8a9a4e
Compare
The unified search modal was intended to be cleared when closed.
However, "UnifiedSearchModal" did not emit "update:query" when its
internal query value ("searchQuery") changed, so "UnifiedSearch.query"
was kept as an empty string. When the modal was closed "update:query"
was emitted with an empty string, which should have cleared
"UnifiedSearch.query" and that, in turn, should have cleared the modal.
However as "UnifiedSearch.query" was already an empty string the watcher
that updates "UnifiedSearchModal.searchQuery" from "UnifiedSearch.query"
was not triggered and the modal was not cleared.
As "UnifiedSearch.query" is now updated with the value of
"UnifiedSearchModal.searchQuery" the latter can not be trimmed when
updated from the former, as that would in turn also trim
"UnifiedSearchModal.searchQuery" and prevent to search for anything with
spaces at the beginning or end (even if those trailing spaces are just
temporary while writing something like "searched value").
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
a8a9a4e to
cf337a7
Compare
|
/compile |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
susnux
reviewed
Jul 16, 2025
skjnldsv
approved these changes
Jul 16, 2025
szaimen
approved these changes
Jul 17, 2025
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.
Tested and works :)
This was referenced Jul 17, 2025
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In the past the (now legacy) unified search was explicitly cleared on navigation changes in the Files app (for example, when changing sections between All files and Recent).
This is no longer the case in the current unified search, as neither
file:navigation:changedis subscribed to reset the search nornextcloud:unified-search:clearis emitted when the navigation changes in the Files app.However, turns out that just closing the modal was intended to clear the query. Due to that there would be no need to explicitly clear it on navigation changes, but clearing the query when closing the modal was not working as expected.
The problem was that
update:querywas not emitted byUnifiedSearchModalwhen its internal query value (searchQuery) was modified (I guess thatupdate:searchQuerywas emitted instead, but I have not actually checked it), soUnifiedSearch.querywas not updated when the query changed in the modal. Due to thatUnifiedSearch.querywas always an empty string, so when the modal was closed and an empty string was explicitly set this did not change its value, the watcher forquerywas not triggered andsearchQuerywas not updated to the empty string, so the search in the modal was not cleared.For reference, updating the query worked fine in
UnifiedSearchLocalSearchBar.How to test
Result with this pull request
The previous search term and results are gone
Result without this pull request
The previous search term and results are still there