darlal/obsidian-switcher-plus

[Bug] Odd Index Bug

Servinjesus1 opened this issue · 1 comments

I'm getting the following error in my console:

Details

TypeError: Cannot read properties of null (reading 'lastIndexOf')
    at le (app.js:1:246572)
    at e.getRecentFiles (app.js:1:1961037)
    at t.getRecentFiles (app.js:1:2008765)
    at ModeHandler.getRecentFiles (plugin:darlal-switcher-plus:4667:47)
    at ModeHandler.addWorkspaceEnvLists (plugin:darlal-switcher-plus:4645:42)
    at ModeHandler.determineRunMode (plugin:darlal-switcher-plus:4462:14)
    at ModeHandler.updateSuggestions (plugin:darlal-switcher-plus:4346:32)
    at SwitcherPlusModal.updateSuggestions (plugin:darlal-switcher-plus:5159:25)
    at t.onOpen (app.js:1:1532256)
    at SwitcherPlusModal.onOpen (plugin:darlal-switcher-plus:5150:19)
e.executeCommand @ app.js:1
app.js:1 Uncaught TypeError: Cannot read properties of null (reading 'lastIndexOf')
    at le (app.js:1:246572)
    at e.getRecentFiles (app.js:1:1961037)
    at t.getRecentFiles (app.js:1:2008765)
    at ModeHandler.getRecentFiles (plugin:darlal-switcher-plus:4667:47)
    at ModeHandler.addWorkspaceEnvLists (plugin:darlal-switcher-plus:4645:42)
    at ModeHandler.determineRunMode (plugin:darlal-switcher-plus:4462:14)
    at ModeHandler.updateSuggestions (plugin:darlal-switcher-plus:4346:32)
    at SwitcherPlusModal.updateSuggestions (plugin:darlal-switcher-plus:5159:25)
    at t.onInput (app.js:1:1532313)
    at t.onInput (app.js:1:2173664)

It does not happen in the sandbox vault, and I've turned off all plugins and restarted my vault, still not working.

Here are my other plugins, though not all of them are typically in use.

Details

advanced-cursors                    excalibrain                         mononote                            obsidian-contextual-typography      obsidian-outliner                   periodic-notes
alx-folder-note                     folder-note-core                    note-refactor-obsidian              obsidian-excalidraw-plugin          obsidian-pandoc                     quick-explorer
alx-folder-note-folderv             highlightr-plugin                   notion-like-tables                  obsidian-file-link                  obsidian-plugin-groups              quickadd
aw-watcher-obsidian                 hotkey-helper                       numerals                            obsidian-git                        obsidian-spaced-repetition          solve
bibnotes                            hotkeysplus-obsidian                obsidian-admonition                 obsidian-hover-editor               obsidian-style-settings             table-editor-obsidian
calendar                            image-captions                      obsidian-advanced-uri               obsidian-hypothesis-plugin          obsidian-tasks-plugin               tag-wrangler
cm-editor-syntax-highlight-obsidian longform                            obsidian-annotator                  obsidian-leaflet-plugin             obsidian-wakatime                   templater-obsidian
darlal-switcher-plus                markdown-attributes                 obsidian-binary-file-manager-plugin obsidian-link-converter             obsidian-zotero-desktop-connector   unitade
dataview                            mathpad                             obsidian-checklist-plugin           obsidian-linter                     obsidian42-strange-new-worlds       various-complements
dbfolder                            maximise-active-pane-obsidian       obsidian-citation-plugin            obsidian-markmind                   oz-image-plugin                     workspaces-plus
emoji-shortcodes                    metaedit                            obsidian-collapse-all-plugin        obsidian-minimal-settings           pane-relief

Let me know how I can help track this bug down.

Sorry it's misbehaving. The fact that it does works properly in a sandbox vault makes me think there's some interaction happening with one or more of the plugins installed. A few questions:

  1. What version of Obsidian are you running?
  2. Does this happen when you try to perform a specific action/sequence of actions, or, every time you try to use the switcher? I'm going to guess every time, but if that's not the case, then it may be useful clue.
  3. Are there any other errors reported in the console beside what you've already shared when it happens?
  4. Do any of those plugins try to "manage", "augment", or otherwise change Obsidian behavior around recently used files? for example, I know there was a plugin that tried to keep a longer list of recently used files (can't remember the name of it) or something like that.

You might try bisecting your plugins. Create a new vault, install the switcher and confirm it works, then install only half of all your plugins and enable them. See if the error occurs after that, if so, then the interaction is with one or more of those plugins. If it doesn't happen then try the same with the other half of your plugins and try again.