mgmeyers / obsidian-kanban

Create markdown-backed Kanban boards in Obsidian.
https://publish.obsidian.md/kanban/
GNU General Public License v3.0
3.16k stars 180 forks source link

[Bug]: Linked note title not updating / refreshing after templater script runs and adjusted the title. #965

Open ghost opened 4 months ago

ghost commented 4 months ago

Describe the bug

The template I have preset within the kanban board has a templater script to add a number to the start of the note title (A1, A2, A3 etc). The idea is to create a unique id counting upwards to give each task a unique identifier that isn't huge. Tasks I work on for different projects will sometimes have the same note title, eg "Export Brand Guidelines".

When I run the template with the templater script through the kanban, the note title is updated to include the latest number, but the linked note title within the kanban card doesn't update and becomes unlinked saying "is not created yet, click to create".

Obsidian_Bug

Screenshot 2024-05-27 at 19 16 47

Expected Behavior

I thought that after running the script the linked note title would update within the Kanban card.

Steps to reproduce

The only way I can get it to render correctly within the list is if I create a linked note, then within the note, manually insert the template with the templater script (via the command palette). It then updates the title within the kanban list. But I don't get why it doesn't update when automated?

Relevant errors (if available)

No response

Operating system

macOS

mgmeyers commented 4 months ago

@pablostuart I don't think there's much I can do about this on my end. I'm not familiar with how templater works, but it seems like Obsidian's file rename mechanism isn't getting triggered by tp.file.rename. It's possible that the newly created file hasn't been cached by the time tp.file.rename is called. What happens if you add await new Promise((res) => setTimeout(res, 1000)) right before tp.file.rename? In theory, that should delay the file rename by 1 second to give Obsidian time to cache the new file.

ghost commented 4 months ago

@mgmeyers adding that worked in the sense that it updates the file name within the board when creating it. But it creates two versions of the note.

Screenshot 2024-05-31 at 07 26 11

I wonder if there's a way in the templater script to remove the other note?

Also, thanks for all the updates and big fixes.