makemd
makemd copied to clipboard
Files Disappear from Space when being Renamed
Original post on Discord here.
Whenever I rename an item, it disappears from the Space.
I found the following potentially relevant error message from the console here:
plugin:make-md:300 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'outlinks')
at Ay.onPathRename (plugin:make-md:300:60311)
onPathRename @ plugin:make-md:300
plugin:obsidian-dictionary-plugin:40
and the sources tab reveals the line here:
async onPathRename(t, r) {
let n = r
, i = this.pathsIndex.get(t)
, a = i?.spaces ?? [];
if (i) {
this.spacesMap.delete(t),
this.spacesMap.deleteInverse(t),
this.linksMap.delete(t),
this.linksMap.deleteInverse(t),
this.pathsIndex.delete(t);
let u = a.map(f=>this.spacesIndex.get(f)).filter(f=>f);
await Hye(this.spaceManager, t, n, u.map(f=>f.space));
for (let f of u)
// the line below is causing the issue
f.metadata?.links?.includes(t) && this.addToContextStateQueue(()=>oy(this, f.path, "links", f.metadata.links.map(d=>d == t ? r : d))),
await this.reloadContext(f.space, !0);
let c = [];
for (let[f,d] of this.contextsIndex)
d.outlinks.includes(t) && c.push(this.spacesIndex.get(d.path).space);
this.addToContextStateQueue(()=>Vye(this.spaceManager, t, n, c).then(f=>Promise.all(c.map(d=>this.reloadContext(d, !0)))))
}
let o = !1;
... etc
But of course this code is generated/minified but for some strange reason, I can't find the corresponding line here:
https://github.com/aseyedia/makemd/blob/f97dfd510257bdd42c80e53283d0145f916d6461/src/core/superstate/superstate.ts#L569-L628
but clearly this has something to do with outLinks.