Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(files): Ensure the filter instance is mounted
`reset` could be called before the filters are mounted,
in this case it is valid to update the presets, but we must not try to
access the vue instance (as it does not exist yet).

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Mar 3, 2025
commit a3f663a2ffa54056defd4604f6238743a7865363
2 changes: 1 addition & 1 deletion apps/files/src/filters/HiddenFilesFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HiddenFilesFilter extends FileListFilter {

constructor() {
super('files:hidden', 0)
this.showHidden = loadState<UserConfig>('files', 'config', { show_hidden: false }).show_hidden
this.showHidden = loadState<Partial<UserConfig>>('files', 'config', { show_hidden: false }).show_hidden

subscribe('files:config:updated', ({ key, value }) => {
if (key === 'show_hidden') {
Expand Down
7 changes: 6 additions & 1 deletion apps/files/src/filters/TypeFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ class TypeFilter extends FileListFilter {

public setPresets(presets?: ITypePreset[]) {
this.currentPresets = presets ?? []
this.currentInstance!.$props.presets = presets
if (this.currentInstance !== undefined) {
// could be called before the instance was created
// (meaning the files list is not mounted yet)
this.currentInstance.$props.presets = presets
}

this.filterUpdated()

const chips: IFileListFilterChip[] = []
Expand Down