Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files Disappear from Space when being Renamed #368

Open
aseyedia opened this issue Sep 25, 2024 · 0 comments
Open

Files Disappear from Space when being Renamed #368

aseyedia opened this issue Sep 25, 2024 · 0 comments

Comments

@aseyedia
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant