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

jTab possibly breaking taitava/obsidian-shellcommands (disappearing shell commands) #15

Closed
davfive opened this issue Feb 29, 2024 · 7 comments
Assignees
Labels
bug Something isn't working completed The fix/enhancement has been implemented and included in a release reproduced The bug has been reproduced

Comments

@davfive
Copy link
Owner

davfive commented Feb 29, 2024

Raised by @taitava via email to me

**From the email thread **
@dokmanc has the same problem, too: #351 (And I never actually got to inspect the problem much, so I still do not have any solutions).

Error in Obsidian console: Step 4:

app.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.

Step 5:

plugin:obsidian-shellcommands:15606 Uncaught TypeError: tab_content.removeClass is not a function
at button.onclick (plugin:obsidian-shellcommands:15606:29)
at createTabs (plugin:obsidian-shellcommands:15648:32)
at SC_MainSettingsTab.display (plugin:obsidian-shellcommands:16620:30)
at t.openTab (app.js:1:2741344)
at HTMLDivElement. (app.js:1:2739783)

I installed the jTab plugin now and was able to reproduce the tab_content.removeClass is not a function error.

I also happened to have a shell command executing via events which outputs text to statusbar, and it has the following error:
kuva.png (view on web)
I suspect that this is also caused by some incompatibility with jTab, as disabling jTab and restarting Obsidian prevented this problem from happening.

I tried to glance through the source code of the jTab plugin quickly, but didn't have enough time to find out anything suspicious. Also, the problem could be in one of the libraries the plugin is using. I'm suspecting that something tampers with global HTMLElement and String objects, as those seem to be missing methods that should normally be available. This is just my guessing, as I didn't go far with my inspections.

The jTab plugin also has this issue mentioning another plugin that suffers from this problem: davfive/obsidian-jtab#10

I thought I'd open up an issue in the jTab plugin's repository myself, too, but I don't have much time now, and also as I think there's already valuable information in this discussion, I'll invite the jTab plugin's author to this discussion. Hello, @davfive ! 🙂 Do you have some opinions on how to go forward with this incompatibility problem? 🙂 I don't have much time to inspect the jTab plugin's source code myself, but if there's anything I can do on my plugin's side, please let me know. 👍

@davfive davfive added bug Something isn't working reviewing... labels Feb 29, 2024
@davfive davfive self-assigned this Feb 29, 2024
@davfive davfive changed the title Fix jTab possibly causing taitava/obsidian-shellcommands disappearing shell commands jTab possibly breaking taitava/obsidian-shellcommands (disappearing shell commands) Feb 29, 2024
@davfive davfive added reproduced The bug has been reproduced and removed status | assessing labels Mar 4, 2024
@davfive
Copy link
Owner Author

davfive commented Mar 4, 2024

No root cause determined yet

I have isolated where

I tried not loading jtab.tardate.js and raphael ... and shellcommands started working again. Now I just have to figure out what specifically is causing the problem so here's my research so far ...

I have ruled out

  1. "Error: Plugin "obsidian-jtab" is not passing Component in renderMarkdown"

    I am aware of this error, and the reason (I knowingly released it that way)
    That error is caused because I wanted to have my help content in the settings page so I render markdown on the settings page. However, Obsidian complains when you render outside of a component (and I don't have one to pass because I am in settings). I always meant to get back to it to see if there was a way to auto-trigger the cleanup - I do detect when someone leaves the settings page because that's when I save the changes.

  2. jtab.tardate.js (original library) using jQuery (loading globally)

    I refacted the original tardate code to remove the jQuery (in case it was stomping on someone elses version). No joy.

  3. jtab.tardate.js (original library) playing tricks with window.onload

    I normalized jtab.tardate.js's use of window.onload. No luck

  4. wrapping jtab.tardate.js properly with the module pattern (anonymous function + limited exports)

    I was hopeful, but this didn't work 😦

Next things to try (not today, I do have to get enough sleep tonight to be present for work tomorrow)

  1. Have jtab.tardate.js stop importing raphael.
  2. Wrap raphael in an anonymous function (I've actually done this a little bit, but I don't think it was fully successful.
  3. Look through raphael code to see if they are doing anything weird.
  4. Sleep on it and see if I have any better ideas tomorrow.

@davfive
Copy link
Owner Author

davfive commented Mar 4, 2024

Referenced in obsidian-shellcommands #351 discussion

@davfive
Copy link
Owner Author

davfive commented Mar 10, 2024

This weekends attempt is to convert the old jtab code to typescript and compile it directly into my plugin. I'm doubting it's the raphael code still seems semi-active (no releases in a while, but it still has 142k weekly downloads and it's @types/raphael was updated last year.

I'll keep you posted.

davfive pushed a commit that referenced this issue Mar 10, 2024
…ript won't solve it, but it'll make me look at the code differently
davfive pushed a commit that referenced this issue Mar 10, 2024
…rary was extending Array with .prototype globally.
davfive added a commit that referenced this issue Mar 10, 2024
Stop breaking shellcmd (#15) and Toggl Track (#10).
@davfive davfive moved this from In Progress to Ready to Publish in jTab Guitar Codeblocks for Obsidian Mar 10, 2024
@davfive davfive added the completed The fix/enhancement has been implemented and included in a release label Mar 10, 2024
@davfive
Copy link
Owner Author

davfive commented Mar 10, 2024

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.

@davfive davfive closed this as completed Mar 10, 2024
@github-project-automation github-project-automation bot moved this from Ready to Publish to Closed in jTab Guitar Codeblocks for Obsidian Mar 10, 2024
@Taitava
Copy link

Taitava commented Mar 12, 2024

Thank you @davfive ! 🙂 I tested upgrading to 1.2.3, then restarted Obsidian and the problem got fixed! 🌞👍

@david-trickybit
Copy link

Thank you very much for taking the time to create this great plugin. 😀

@davfive
Copy link
Owner Author

davfive commented Mar 16, 2024

@david-trickybit Thanks for the complementary note on my plug-in. Always nice to hear from a fan 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed The fix/enhancement has been implemented and included in a release reproduced The bug has been reproduced
Development

No branches or pull requests

3 participants