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

Looping Templater renames on multiple devices / computers #1534

Open
chrisweis opened this issue Jan 30, 2025 · 3 comments
Open

Looping Templater renames on multiple devices / computers #1534

chrisweis opened this issue Jan 30, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@chrisweis
Copy link

Plugin information (please complete the following information):

  • OS: MacOS Sonoma 14.7, Windows 11 (latest), IOS (latest)
  • Templater version: 2.9.1 (and just updated to 2.9.2)
  • Obsidian version: 1.7.7
  • Templater settings: Template folder location Templates/, Trigger Template on new file creation, Enable folder templates (12 different folders), Template hotkeys (4)

Describe the bug
I pay for Obsidian Sync (and have no other third party syncing in use).
When I add a new file in a folder template location, it works fine if only one device is running.
But if I have Obsidian open on multiple devices, it causes and almost-endless loop of renaming the files, where the unique timestamp is repeated in the title. While taking notes, I'm unable to work since the file keeps moving to a new name (probably triggered by the other active device).

Does anyone have any ideas for how to prevent this looping file rename?

An example of the log (shortened to keep this issue readable):

2025-01-29 11:37 - Fully synced
2025-01-29 11:39 - Uploading file 🏠 Personal/🗄️ DropZone/Untitled.md
2025-01-29 11:39 - Upload complete 🏠 Personal/🗄️ DropZone/Untitled.md
2025-01-29 11:39 - Deleting remote file 🏠 Personal/🗄️ DropZone/Untitled.md
2025-01-29 11:39 - Uploading file 🏠 Personal/🗄️ DropZone/202501291139 Untitled.md
2025-01-29 11:39 - Upload complete 🏠 Personal/🗄️ DropZone/202501291139 Untitled.md
2025-01-29 11:39 - Uploading file .obsidian/plugins/recent-files-obsidian/data.json
2025-01-29 11:39 - Upload complete .obsidian/plugins/recent-files-obsidian/data.json
2025-01-29 11:39 - Fully synced
2025-01-29 11:39 - Server pushed (deleted or renamed) [FRACTAL] 🏠 Personal/🗄️ DropZone/202501291139 Untitled.md
2025-01-29 11:39 - Server pushed [FRACTAL] 🏠 Personal/🗄️ DropZone/202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Deleting 🏠 Personal/🗄️ DropZone/202501291139 Untitled.md
2025-01-29 11:39 - Accepted 🏠 Personal/🗄️ DropZone/202501291139 Untitled.md
2025-01-29 11:39 - Downloading file 🏠 Personal/🗄️ DropZone/202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Downloading complete 🏠 Personal/🗄️ DropZone/202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Accepted 🏠 Personal/🗄️ DropZone/202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Deleting remote file 🏠 Personal/🗄️ DropZone/202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Uploading file 🏠 Personal/🗄️ DropZone/202501291139 202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Upload complete 🏠 Personal/🗄️ DropZone/202501291139 202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Server pushed (deleted or renamed) [FRACTAL] 🏠 Personal/🗄️ DropZone/202501291139 202501291139 202501291139 Untitled.md
... (log lines removed)...
2025-01-29 11:39 - Downloading file 🏠 Personal/🗄️ DropZone/202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Downloading complete 🏠 Personal/🗄️ DropZone/202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Accepted 🏠 Personal/🗄️ DropZone/202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 202501291139 Untitled.md
2025-01-29 11:39 - Fully synced

Expected behavior
I want Templater to only run on the device with Obsidian that I'm actually using, not the one sitting idle.
I want an option that allows me to "Ignore Obsidian Sync changes" in the template folders, to prevent the looping.

Screenshots
I could record a video and share as a DM if that would help?

Additional context
My template code is:

<% await tp.file.rename(tp.date.now("YYYYMMDDHHmm") + " " + tp.file.title) %>

Thanks!!!

@chrisweis chrisweis added the bug Something isn't working label Jan 30, 2025
@Zachatoo
Copy link
Collaborator

Is that your full template? I can repro if that is my full template. If my template has anything that adds content to the note (even a space or a blank line), then it will not get stuck in a loop.

@chrisweis
Copy link
Author

chrisweis commented Jan 31, 2025

Edit: Adding a single space to the template fixed it, thanks! I've never fixed such a big annoying problem with such a tiny change 😂


Is that your full template? I can repro if that is my full template. If my template has anything that adds content to the note (even a space or a blank line), then it will not get stuck in a loop.

What does “I can repro” mean? You can reproduce it?

Yes, that’s the full template. I’ve been wondering if it might be interacting with another plugin, but I’m not sure how to diagnose that without turning off/on every plugin. And I can’t think of a plugin that might be related (I have the Core unique note feature off).

I agree, any content prevents the issue. So maybe I just need to add a small bit of content into the template? Will try that (so easy) thanks!!

@Zachatoo
Copy link
Collaborator

Zachatoo commented Feb 1, 2025

Awesome! I'll keep this open since it's still a valid bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants