mirnovov / obsidian-homepage

An Obsidian plugin that opens a specified note, canvas, or workspace on startup, instead of the most recent one.
MIT License
374 stars 18 forks source link

Uncaught illegal access—infinite loop #87

Closed itsonlyjames closed 2 months ago

itsonlyjames commented 2 months ago

Details

Uncaught illegal access is looped when reopening Obsidian after a child window was previously opened.

image

Steps to reproduce

  1. Install Homepage plugin
  2. open current tab in new window or move current tab to new window—child window is now open
  3. Quit Obsidian (Mac—I use cmd + q)
  4. Reopen Obsidian, it will attempt to open the child window and throw this error in the main windowblocking UI rendering

Debug information

No response

Checklist

mirnovov commented 2 months ago

I can't reproduce this - can you give more details as to what plugins you have active and what settings Homepage is set to?

(Note that I also use Mac so it's not that)

itsonlyjames commented 2 months ago

Did some more testing to try and narrow down the subsequent plugin causing issues—can't seem to find it.

I was able to get it in a way that the issue does not occur, but then intermitently it would cause the loop again. I am almost certain it is due to the order in which plugins are being loaded. For example, I added each of my plugins back in one-by-one (so tedious), and the issue did not occur. It wasn't until a few quits and restarts that it occured again.

See if you can repro with my setup (I hope Obsidian does auto-download of these plugins lol): community-plugins.json

[
  "dataview",
  "calendar",
  "tag-wrangler",
  "templater-obsidian",
  "obsidian-linter",
  "obsidian-kindle-plugin",
  "settings-search",
  "obsidian-focus-mode",
  "obsidian-charts",
  "cm-editor-syntax-highlight-obsidian",
  "keyshots",
  "nldates-obsidian",
  "sync-graph-settings",
  "periodic-notes",
  "homepage",
  "heatmap-calendar",
  "obsidian-kanban",
  "obsidian-excalidraw-plugin",
  "quick-latex",
  "obsidian-image-toolkit",
  "obsidian-pandoc",
  "darlal-switcher-plus",
  "obsidian-tikzjax",
  "pdf-plus",
  "optimize-canvas-connections",
  "advanced-canvas",
  "sticky-heading"
]

homepage/data.json

{
  "version": 3,
  "homepages": {
    "Main Homepage": {
      "value": "Home",
      "kind": "Daily Note",
      "openOnStartup": true,
      "openMode": "Replace all open notes",
      "manualOpenMode": "Keep open notes",
      "view": "Default view",
      "revertView": true,
      "openWhenEmpty": false,
      "refreshDataview": false,
      "autoCreate": true,
      "autoScroll": false,
      "pin": false,
      "commands": [],
      "alwaysApply": false
    }
  },
  "separateMobile": false
}

Image of console when fail: image

Image of console when successful: image

Makes me think it's dataview causing the issue, which correlates with my suspicion about the order of loading. E.g., if it finishes quick enough the error doesn't occur

mirnovov commented 2 months ago

It's not dataview causing the issue, but it is indeed timing based. It appears that when lots of plugins are installed, even if no others are enabled, the issue appears. This is presumably due to Obsidian taking longer to load; it still iterates through plugins even if they aren't enabled.

I'll work on a fix.