davfive / obsidian-jtab

jTab Guitar Codeblocks for Obsidian adds the ability to show guitar chords and tabs directly in your notes.
MIT License
65 stars 1 forks source link

Fix settings render being called w/o component #17

Closed davfive closed 4 months ago

davfive commented 4 months ago

Overview

To provide an in-settings guide for users, I used MarkdownRenderer.renderMarkdown() with markdown to more easily created the guide contents. However, I didn't fully understand the call and was getting errors:

pp.js:1 Error: Plugin "obsidian-jtab" is not passing Component in renderMarkdown. This is needed to avoid memory leaks when embedded contents register global event handlers.
at t.render (app.js:1:1276278)
at t.renderMarkdown (app.js:1:1276059)
at Il.display (plugin:obsidian-jtab:249:2362)
at t.openTab (app.js:1:2741344)
at HTMLDivElement. (app.js:1:2739783)
I'm not certain about this problem, but I guess it's not actually causing these bugs. It might be just some unrelated other issue with jTab? But I'm not 100 % sure this doesn't cause the actual problem.

Changes

Create a MarkdownRenderChild with the parent div so that the div can be cleaned up when the settings are closed.

davfive commented 4 months ago

This issue has been fixed and is included in the v1.2.3 package release. Download or update it in Obsidian Settings under Community Plugins.