-
Notifications
You must be signed in to change notification settings - Fork 647
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
When including note with links to non-existent files, getting "cyclic link detected" warning #1282
Comments
Thanks for reporting the issue. As we recently changed the code in that area let me check with @badsketch in case this rings a bell |
Nice catch! I took a look and it seems to stem from an edge case when extracting text for a note during embedding. Wikilinks that are part of the note we are embedding get converted to a link relative to the current note using
Also related thought - haven't tested this, but do our panels ( |
Thanks for properly dissecting what's happening there, makes sense. |
I realized we currently return the bare text if the note doesn't exist, so in the case of embedding a note which is embedding another note that doesn't exist, maybe n.1 would be more consistent with existing behavior after all? A placeholder for both |
I got confused between the wikilink and the embed. To me there are 2 options at that point:
Given that an embed is not a link I totally agree we shouldn't just turn the placeholder into a link. Thoughts? |
Both options make sense to me! Happy to implement n.2, but figured it would take more discussions and design iterations 🙂 Raised a PR implementing n.1 as a quick fix since I think the issue could be annoying in a case where a user accidentally embeds a note that doesn't exist. Then they create it. But now the ref stack permanently has this note in there. Now any new note that tries to embed the note will result in a cyclic link error unless they restart Foam. |
Describe the bug
Attempting to include a note via ![[included note]] syntax. The included note contains placeholder link to a non-existent note. That results in the original note not being rendered and producing a "Cyclic link detected for wikilink: included note" warning.
Small Reproducible Example
https://github.com/Aristarkh4/foam-inclusion-nonexistenfiles-bug/tree/master
Steps to Reproduce the Bug or Issue
Expected behavior
As a user I would expect the inclusion of the note to be successful with placeholder link being rendered as it would be rendered in a greyed-out state. Instead, I'm getting the "Cyclic link detected for wikilink: included note" warning.
Screenshots or Videos
The "monthly" note:
The "weekly" code (included note):
The failing preview of "monthly" note:
Operating System Version
OS: Windows
Visual Studio Code Version
1.81.1
Additional context
No response
The text was updated successfully, but these errors were encountered: