TfTHacker / obsidian42-strange-new-worlds

Revealing the strange new world of connected thoughts in your vault.
https://tfthacker.com/SNW
MIT License
432 stars 13 forks source link

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'start') #107

Closed bkennedy-improving closed 9 months ago

bkennedy-improving commented 1 year ago

I'm receiving the following errors on mouse over of SNW's included number of links with the following:

Mouse over SNW Note level number

plugin:obsidian42-strange-new-worlds:2 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'start')
    at Hr (plugin:obsidian42-strange-new-worlds:2:227)
    at wo (plugin:obsidian42-strange-new-worlds:2:4670)
    at async Wn (plugin:obsidian42-strange-new-worlds:2:3037)
    at async an (plugin:obsidian42-strange-new-worlds:2:5096)
    at async eval (plugin:obsidian42-strange-new-worlds:2:20558)
Hr @ plugin:obsidian42-strange-new-worlds:2
wo @ plugin:obsidian42-strange-new-worlds:2
setTimeout (async)
onShow @ plugin:obsidian42-strange-new-worlds:2
ni @ plugin:obsidian42-strange-new-worlds:1
gt @ plugin:obsidian42-strange-new-worlds:1
ft @ plugin:obsidian42-strange-new-worlds:1

Mouse over SNW In line Link number

plugin:obsidian42-strange-new-worlds:2 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'start')
    at Hr (plugin:obsidian42-strange-new-worlds:2:227)
    at wo (plugin:obsidian42-strange-new-worlds:2:4670)
    at async Wn (plugin:obsidian42-strange-new-worlds:2:3037)
    at async an (plugin:obsidian42-strange-new-worlds:2:5096)
    at async eval (plugin:obsidian42-strange-new-worlds:2:20558)
Hr @ plugin:obsidian42-strange-new-worlds:2
wo @ plugin:obsidian42-strange-new-worlds:2
setTimeout (async)
onShow @ plugin:obsidian42-strange-new-worlds:2
ni @ plugin:obsidian42-strange-new-worlds:1
gt @ plugin:obsidian42-strange-new-worlds:1
ft @ plugin:obsidian42-strange-new-worlds:1

Code being complained about

var Hr = async e=>{
        let t = createDiv();
        t.addClass("snw-ref-item-info"),
        t.addClass("search-result-file-match"),
        t.setAttribute("snw-data-line-number", e.reference.position.start.line.toString()), //Fails here
        t.setAttribute("snw-data-file-name", e.sourceFile.path.replace(".md", "")),
        t.setAttribute("data-href", e.sourceFile.path.replace(".md", ""));
        let n = await bo(e);
        return t.appendChild(n),
        t
    }

This only occurs for a couple of specific notes, so I'm wondering if there's a particular way the note is being referenced that is catching SNW up. Unfortunately the examples I have this are deeply referenced notes and will require some time to dig through.

Some additional information:

In both cases, I was able to reproduce the same issues as stated above.

I will see if I can isolate down the issue further when I get a chance.

Thanks!

kearaa commented 1 year ago

I have the same problem, showing the same error. On most notes, the counters show up but the mouse over doesn't produce anything, and clicking doesn't open it in the sidebar.

Do you have insider builds with the new Properties?

I found one note that still worked, and I found that if I linked the note in the Properties frontmatter of another note, the SNW sidebar and mouseover stopped working. When I deleted the Properties reference, it worked again.

bgk0018 commented 1 year ago

Your issue sounds just like mine. I use frontmatter property linking a lot ever since that was made more robust/available so that would track with your reproduction steps.

TfTHacker commented 1 year ago

Hi folks, thank you for reporting this. I will be taking a look at it. The Obsidian beta has broken a few things :-)

TfTHacker commented 9 months ago

I believe this is now resolved.