[Files]: Fixes the filter buttons behavior in the Recents view.
The current code uses query only to decide if the filter buttons are visible. However, it is possible to erase the query, while keeping search open. This change keeps track of search being active or inactive. When the state changes either from inactive to active, or active to inactive, the corresponding visibility change is enacted on the filter button container. Bug: b:391747048 Change-Id: I70a338aa50f6d48da80b6f7017b965448fb70fda Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6193185 Commit-Queue: Bo Majewski <majewski@chromium.org> Reviewed-by: Alexander Bolodurin <alexbn@chromium.org> Cr-Commit-Position: refs/heads/main@{#1417952}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
021218565d
commit
9421aff8cf
@ -9,6 +9,7 @@ import {isSameEntry} from '../../common/js/entry_utils.js';
|
||||
import type {FakeEntry} from '../../common/js/files_app_entry_types.js';
|
||||
import {recordEnum} from '../../common/js/metrics.js';
|
||||
import {str, strf} from '../../common/js/translations.js';
|
||||
import {isSearchEmpty} from '../../state/ducks/search.js';
|
||||
import type {State} from '../../state/state.js';
|
||||
import {getStore} from '../../state/store.js';
|
||||
|
||||
@ -80,7 +81,7 @@ export class FileTypeFiltersController {
|
||||
onStateChanged(state: State) {
|
||||
if (this.inRecent_) {
|
||||
const search = state.search;
|
||||
this.container_.hidden = !!(search?.query);
|
||||
this.container_.hidden = (search !== undefined) && !isSearchEmpty(search);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user