Skip to content

Datacore codeblocks break upon encountering a canvas on startup #165

@Kokolokoli

Description

@Kokolokoli

Bug

Upon encountering an Obsidian Canvas in the initial import of the files into Datacore when starting up Obsidian, the scheduel method of the FileImporter throws the following error:

Image

Environment

OS: Archlinux
Obsidian: 1.12.4
Datacore: 0.1.28

To reproduce

  • Have a test.md file at the root of your vault. Only have a datacore codebloc within with the following code inside it:
return function View() {
   return <p>Hello!</p>;
}
  • Have an obsidian canvas file at the root of your vault.
  • Enable Datacore and restard Obsidian.

The Test.md file should show something like this:

Image

and the error should appear in the obsidian developper Console.

What I have found

It seems like the FileImporter's fileManager is undefined as it's not initialized in the constructor. Entering the canvas case of the scheduel() function should therefore always trigger the nullish coalescing operator on line 111.

However, when I go look into the datacore installed file (.obsidian/plugins/datacore/main.js), the optional chaining operators and the nullish coalescing operator, as well as it's right side, are completely missing!

Image

Could it be that the operators were removed as a result of some undesired build optimization?

After manually adding them to the main.js file and restarting obsidian, the error message changes:

Image

but it no longer breaks the codeblock:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions