From d255b5b0e33e863bf641a232cc5dcb49e6365413 Mon Sep 17 00:00:00 2001 From: Lisandra Date: Wed, 4 Dec 2024 09:30:48 +0100 Subject: [PATCH] fix(fix-mobile-icon): on mobile, custom rules doesn't load at startup (#624) close #617 Co-authored-by: Lisandra Simonetti --- src/lib/custom-rule.ts | 2 +- src/settings/ui/customIconRule.ts | 2 +- src/settings/ui/emojiStyle.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/custom-rule.ts b/src/lib/custom-rule.ts index dde711e2..08139f72 100644 --- a/src/lib/custom-rule.ts +++ b/src/lib/custom-rule.ts @@ -190,7 +190,7 @@ const getFileItems = async ( ): Promise => { const result: FileItem[] = []; for (const fileExplorer of plugin.getRegisteredFileExplorers()) { - const files = Object.values(fileExplorer.fileItems); + const files = Object.values(fileExplorer.fileItems || {}); for (const fileItem of files) { if (await isApplicable(plugin, rule, fileItem.file.path)) { result.push(fileItem); diff --git a/src/settings/ui/customIconRule.ts b/src/settings/ui/customIconRule.ts index 515f56a5..62e22ab9 100644 --- a/src/settings/ui/customIconRule.ts +++ b/src/settings/ui/customIconRule.ts @@ -180,7 +180,7 @@ export default class CustomIconRuleSetting extends IconFolderSetting { const addedPaths: string[] = []; for (const fileExplorer of this.plugin.getRegisteredFileExplorers()) { - const files = Object.values(fileExplorer.fileItems); + const files = Object.values(fileExplorer.fileItems || {}); for (const rule of customRule.getSortedRules(this.plugin)) { // Removes the icon tabs from all opened files. this.updateIconTabs(rule, true, addedPaths); diff --git a/src/settings/ui/emojiStyle.ts b/src/settings/ui/emojiStyle.ts index 890a07be..444d501d 100644 --- a/src/settings/ui/emojiStyle.ts +++ b/src/settings/ui/emojiStyle.ts @@ -29,7 +29,7 @@ export default class EmojiStyleSetting extends IconFolderSetting { private updateDOM(): void { for (const fileExplorer of this.plugin.getRegisteredFileExplorers()) { - const fileItems = Object.entries(fileExplorer.fileItems); + const fileItems = Object.entries(fileExplorer.fileItems || {}); for (const [path, _] of fileItems) { let iconName = this.plugin.getData()[path] as string | undefined | null; if (!iconName) {