chrisgurney / obsidian-note-toolbar

Plugin for Obsidian providing a flexible way to create context-aware toolbars for your notes.

Home Page:https://github.com/chrisgurney/obsidian-note-toolbar/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clicking any Button Causes Obsidian to Reload

MrComputron opened this issue · comments

Screen_Recording_20240416_220328_Obsidian.mp4
Screen_Recording_20240416_220616_Obsidian.mp4

Selecting any button in a toolbar on mobile causes Obsidian to reload.

Steps to reproduce

  1. Be in obsidian (either live preview or preview)
  2. Click any note toolbar button

Expected behavior

  • Expect the action to be performed without reloading the vault
  • Sometimes performs the action, then quickly afterwards reloads the vault

Screenshots (if you think it will help)
Video or a GIF would be appreciated.

Theme links and CSS snippets (if applicable):
Issue occurs with all themes, however installed themes are:

  • Wikipedia
  • Vicious
  • Ultra Lobster
  • Typomagical
  • Serenity
  • PLN
  • Origami
  • Obuntu
  • ObsidianNotion
  • Minimal
  • Heboric
  • Gummy
  • Garden Gnome (Adwaita, GTK)
  • Encore
  • Dracula Official
  • Border
  • Bolt
  • AnuPpuccin

Plugin links (if applicable):
If you're using a specific plugin that isn't working with the toolbar, link it here.
Not sure if any of these is responsible

  • Abbreviations expander
  • Auto note mover
  • Book search
  • Buttons
  • Checklist
  • Commander
  • Dataview
  • Floating Search
  • Footnote shortcut
  • Force note view mode
  • Heatmap calendar
  • Ink
  • List callouts
  • map view
  • meta bind
  • natural language dates
  • note refactor
  • note toolbar
  • obsidian columns
  • omnivore
  • paste url into selection
  • periodic notes
  • quick switcher ++
  • Quickadd
  • slash commander
  • style settings
  • tag wrangler
  • tasks
  • templater
  • tracker
  • typewriter scroll
  • various complements

Desktop environment:

  • OS: Windows 10 Pro
  • Obsidian version:
  • Note Toolbar version:

Mobile environment (if applicable to the issue):

  • Device:
  • OS:
  • Obsidian version: 1.5.12
  • Note Toolbar version: 1.4.12

Additional context
Thanks.

@MrComputron thanks for logging the issue!

Can you provide more details on what the links in your toolbar are that you're getting this result with? Are they Commands, Files, or URIs? What exactly are they?

Just added a couple of screen recordings above.
All the Note Toolbar buttons added are commands. I have not yet tested out links or URI with NT.

@MrComputron Thanks for the recordings. Can you give an example of one of the commands you're using that's exhibiting the issue?

All commands have at times had this issue. Commands I've set up in toolbars include:

  • Bookmark file
  • Bookmark block under cursor
  • Bookmark heading under cursor
  • Open settings
  • Note composer extract heading
  • Move current file to another folder
  • Previous daily note
  • Next daily note
  • Daily note
  • Book search create new book note
  • Change theme
  • (Ink plugin) New drawing / new writing
  • Toggle live preview / source mode
  • Toggle reading view

The major frustration with it is that it works and stops working inconsistently...sometimes it works for 5-6 button presses before it reloads, sometimes it reloads on the first, and there is no obvious pattern to when it will reload.

@MrComputron Appreciate all the details so far.

Is it possible to perhaps start a new vault with just the Note Toolbar plugin and use a core plugin command, to see if it happens with that setup?

@MrComputron If you're willing to try out the beta, I've just pushed an update that you can try: look for v1.5.6-beta or later. I'd be interested in whether this fixes the issue for you or not.

Technical Notes

The change was moving the preventDefault() calls earlier in the click handler, which previously were after attempting to execute the command. My theory (unproven) is that occasionally, with lots of plugins, that call might take a while to do, and without the preventDefault() being earlier was allowing the click (to #) to actually go through. (I've just read it's good practice to do the preventDefault() earlier, anyway.)

@MrComputron The latest version is now available on Community Plugins with this change. Please let me know if it helps! 🤞

It is all working without issue now and I am very pleased about it. Thanks for the update and again for all the work you are putting into this plugin!