mdelobelle / obsidian_supercharged_links

obsidian plugin to add attributes and context menu options to internal links

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Latest version of Supercharged links (0.11.0) prevents me from opening certain files (demo)

FeralFlora opened this issue · comments

When I try to open my Home note, I get this error in the console:

app.js:1 Uncaught TypeError: Cannot read properties of null (reading 'startsWith')
    at HeaderWidget.toDOM (livePreview.ts:29:42)
    at t.sync (app.js:1:373197)
    at e.sync (app.js:1:364089)
    at t.sync (app.js:1:386233)
    at e.sync (app.js:1:364445)
    at app.js:1:405553
    at e.ignore (app.js:1:478915)
    at t.updateInner (app.js:1:405349)
    at t.update (app.js:1:405110)
    at e.update (app.js:1:487274)
    at e._dispatch (app.js:1:484011)
    at e.dispatch (app.js:1:485789)
    at eval (plugin:obsidian-banners:66:45950)
    at t.iterateLeaves (app.js:1:2016992)
    at t.eval (plugin:obsidian-hover-editor:18:6742)
    at t.E [as iterateLeaves] (plugin:obsidian-hover-editor:14:13136)
    at t.iterateLeaves (app.js:1:2017090)
    at t.eval (plugin:obsidian-hover-editor:18:6742)
    at t.E [as iterateLeaves] (plugin:obsidian-hover-editor:14:13136)
    at t.iterateLeaves (app.js:1:2017090)
    at t.eval (plugin:obsidian-hover-editor:18:6742)
    at t.E [as iterateLeaves] (plugin:obsidian-hover-editor:14:13136)
    at t.iterateRootLeaves (app.js:1:2017175)
    at eval (plugin:obsidian-banners:66:45813)
    at e.tryTrigger (app.js:1:695499)
    at e.trigger (app.js:1:695432)
    at t.trigger (app.js:1:2028169)
    at t.updateLayout (app.js:1:2020822)
    at r (app.js:1:1972110)
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:204:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
toDOM @ livePreview.ts:29
t.sync @ app.js:1
e.sync @ app.js:1
t.sync @ app.js:1
e.sync @ app.js:1
(anonymous) @ app.js:1
e.ignore @ app.js:1
t.updateInner @ app.js:1
t.update @ app.js:1
e.update @ app.js:1
_dispatch @ app.js:1
e.dispatch @ app.js:1
eval @ plugin:obsidian-banners:66
t.iterateLeaves @ app.js:1
eval @ plugin:obsidian-hover-editor:18
E @ plugin:obsidian-hover-editor:14
t.iterateLeaves @ app.js:1
eval @ plugin:obsidian-hover-editor:18
E @ plugin:obsidian-hover-editor:14
t.iterateLeaves @ app.js:1
eval @ plugin:obsidian-hover-editor:18
E @ plugin:obsidian-hover-editor:14
t.iterateRootLeaves @ app.js:1
eval @ plugin:obsidian-banners:66
e.tryTrigger @ app.js:1
e.trigger @ app.js:1
t.trigger @ app.js:1
t.updateLayout @ app.js:1
r @ app.js:1
(anonymous) @ node:internal/process/task_queues:140
runInAsyncScope @ node:async_hooks:204
runMicrotask @ node:internal/process/task_queues:137
setTimeout (async)
e.tryTrigger @ app.js:1
e.trigger @ app.js:1
t.trigger @ app.js:1
t.updateLayout @ app.js:1
r @ app.js:1
(anonymous) @ node:internal/process/task_queues:140
runInAsyncScope @ node:async_hooks:204
runMicrotask @ node:internal/process/task_queues:137

Here's a screen recording demonstrating the issue:
Obsidian_EdwJ52j8Qd

Disclaimer: I am not a dev or user of this plugin.

The stack trace points to obsidian-hover-editor and obsidian-banners. What happens if you disable these?

Disclaimer: I am not a dev or user of this plugin.

The stack trace points to obsidian-hover-editor and obsidian-banners. What happens if you disable these?

I'm not sure, but before I try that, note that:

  • If I disable Supercharged links, I can open the note without issue.
  • After downgrading to the previous version of Supercharged links, I can open the note without issue with Supercharged links enabled.
  • startsWith is part of the changed code in the last update.

Actually, I won't be testing that just now, because I've downgraded for now.

Disclaimer: I am not a dev or user of this plugin.

The stack trace points to obsidian-hover-editor and obsidian-banners. What happens if you disable these?

It's likely that version 0.11.0 of Supercharged Links has some bad interaction with Banners, since I only had the issue of not being able to open the note, when the note had a banner. But again, the previous version works fine with banners.

my bad, the first entry in the stack trace is actually this plugin. It seems like the is a missing null check on this line https://github.com/mdelobelle/obsidian_supercharged_links/blob/c549bc7c74c24b71baaa0b156751012580757a31/src/linkAttributes/livePreview.ts#L29C18-L29C18

Or maybe not since it is typed as Record<string, string>, and the error is most likely introduced here. That is why any is dangerous.

Hi there, oops, that doesn't look good. I agree @mProjectsCode with your first observation. @FeralFlora can you check out v0.11.1?

The update seems to have resolved this. I can now open notes with banners again.