mProjectsCode / obsidian-meta-bind-plugin

A plugin for Obsidian to make your notes interactive with inline input fields, metadata displays, and buttons.
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/
GNU General Public License v3.0
473 stars 38 forks source link

MB_UNLOADED appears on every rename or move of a note #314

Closed martyn0ff closed 5 months ago

martyn0ff commented 5 months ago

Please fill out these Check-boxes

This Issue Occurs on

Plugin Version

1.1.0

Describe the Issue

Hey, First of all thank you for this awesome plugin. It is essential to my Obsidian flow.

I've been experiencing appearance of [MB_UNLOADED] on all items produced by Meta Bind when I either rename a note or move a note (programmatically or not). Reloading the note does help. At first I thought that some plugin interferes with MB, but I've just tried to reproduce this on brand new vault and behavior is the same. That would be great to have a checkbox for force reload of a note where MB items are present when note is renamed or moved.

Steps to Reproduce

  1. Create brand new vault (Obsidian v1.5.12)
  2. Install Meta Bind from Community Plugins
  3. Embed a button (any button, action does not matter)
  4. Rename a note
  5. Observe [MB_UNLOADED] appearing after rename (in Edit mode only, preview mode functions normally)

Expected Behavior

[MB_UNLOADED] does not appear on rename or on note move.

mProjectsCode commented 5 months ago

This is intended behavior. Fields save a reference to the file path that they are in. After a rename this file path would be invalid and things relying on said path might produce incorrect results.

Kainkun commented 4 months ago

@mProjectsCode any suggestions for making this work with Templater? I don't think I can set the name for a created template before the meta bind stuff tries to load?

martyn0ff commented 4 months ago

@mProjectsCode but wouldn't it make sense to reload current note after the rename? Or at least provide an option to turn this feature on? From the docs that you provide this was not clear that this is intended behavior. I thought that something interferes with your plugin. IMO this gives much better UX than having to do this manually. @Kainkun I'd look into integrating programmatic reload of a note with app.workspace.activeLeaf.rebuildView() as a workaround. Maybe delay that for a few ms.

ytmaps commented 5 hours ago

I also encountered the same problem, which is of great significance to my workflow. I would like to ask, have you found a solution? @martyn0ff

mProjectsCode commented 19 minutes ago

related issue #396

I am currently planning an update to some core parts of the code base that should hopefully allow for this behavior to be "fixed".