quickadd icon indicating copy to clipboard operation
quickadd copied to clipboard

[BUG] Template path is not saved

Open wwwald opened this issue 2 years ago • 6 comments

Describe the bug Relatively new user of Obsidian, so I'm still configuring and iterating a lot, also with the QuickAdd plugin.

When adding a new choice, I often see that the Template path value doesn't "stick" when being configured. I can change it, but when using the Quickadd command afterwards, I get an "invalid template path" error that still refers to the old value.

Restarting Obsidian sometimes helps: I can usually make one adjustment and that is applied correctly. But when making further adjustments, QuickAdd seems to get stuck on the old value again and I need another restart.

To Reproduce Steps to reproduce the behavior:

  1. Start Obsidian
  2. Go to QuickAdd settings, add a new Choice and enable it as a command
  3. Configure the "Template path" with a correct path to a template file
  4. Close Settings dialogs
  5. Ctrl+P → choose the new QuickAdd command
  6. ERROR: "Please specify a path"... so it still assumes that my Template path is empty (= the "old" value)

This is only one example with a newly configured Choice. Adjusting existing Choices gives me the same problem: QuickAdd reverts to using the old, previously configured value instead of the new one.

Expected behavior QuickAdd should save the last entered Template path value?

Desktop (please complete the following information):

  • OS: Windows 10
  • Version: Obsidian 0.14.6, QuickAdd 0.5.5

wwwald avatar Apr 22 '22 06:04 wwwald

I am getting the same error "Please provide template path" ..., the same version of plugin + template EDIT: the error was in the macro I wasn't using when running my current command, after deleting the macro everything works fine

danieltomasz avatar Apr 24 '22 21:04 danieltomasz

I debugged it even more, it seems that changing template without restarting Obsidian doesn't make template to change in QuickAdd, only after restarting the plugin/obsidian it loads the last version of the template/last path; But the problem was present when I was using Templater scripts, when I am just changing text file everything is ok

For example

<%*
let title = await tp.system.prompt("Title");
await tp.file.move("/Resources/Annotations/"+ title);
%>
---

Persisted and was keeping asking me twice for the file title, even if I changed the template to a second file containing

<%*
let title = tp.file.title ;
%>

After restart it works as expected

danieltomasz avatar Apr 24 '22 22:04 danieltomasz

@danieltomasz: I don't fully understand your last comment - did you find a fix? Or did you confirm the buggy behavior, that restarts are always needed?

wwwald avatar Apr 27 '22 07:04 wwwald

I am having this issue as well, the dialog to chose a folder/file doesn't even pop up, and after restarting running the command does nothing.

Edit:

Obsidian v0.14.6 On manjaro linux from the arch repos.

spxtator avatar Apr 27 '22 22:04 spxtator

@wwwald

1 First issue: ERROR: "Please specify a path" - I solved it by manually editing the data file in the hidden plugin folder .obsidian/plugins/quickadd and removing macro that hasn't specified a path 2. Later I found that sometimes the quick-add doesn't internally change the path to template even if I replace the path and point to another template (the old template containing templater commands was still loading, restart fixed this) 3. After restart I didn't thoroughly test but local changes in the same template are reflected, I didn't try changing template file

danieltomasz avatar Apr 27 '22 22:04 danieltomasz

I have the ERROR: "Please specify a path" issue as well. Running the QuickAdd: Run <macro name> command fails, but the QuickAdd: Run QuickAdd -> <macro name> command works as expected.

It seems to happen when the option to add a command for a macro is toggled before the template path is defined. Works fine when the command option is toggled after.

Restarting Obsidian fixes it. Toggling the command option to disabled then enabled seems to fix it as well.

ghost avatar May 05 '22 20:05 ghost

this is still an issue, so I'm here to add some more info: quickadd doesn't recognize any changes made until I restart the plugin (template path, file capture path, changes to macros, etc.) or cycle the command toggle.

As ghost stated, this seems to be some issue with the plugin re-caching only when the command toggle is messed with; if you have a functional template command for example and decide to change the template path, it will only reflect once you flip the command toggle on and off again.

AthreyaV avatar Nov 09 '22 14:11 AthreyaV

Hi everyone! I have the same issue on windows, and nothing helps to solve it from the solutions above. Any hint would really appreciated, thanks

ixnet avatar Nov 25 '22 17:11 ixnet

It works okay with File name format option turned off: image

ixnet avatar Nov 25 '22 18:11 ixnet

You should reactive the choice after you modify it.

Yunz93 avatar Nov 26 '22 06:11 Yunz93

It works okay with File name format option turned off: image

Doesn't work regardless of where the setting is enabled or otherwise. My kludgey workaround is to prompt for a tag and then move the new file to the right folder.

z024966 avatar Jan 25 '23 17:01 z024966

In my case, the problems disappeared when I used a hyphen between the {{date}} and {{value}} statements

ghost avatar Feb 06 '23 10:02 ghost

Hello everyone. I really appreciate you taking the time to report in on this issue.

This bug has been fixed as of 0.11: https://github.com/chhoumann/quickadd/releases/tag/0.11.0

Commands are now updated whenever you save. Thank you!

chhoumann avatar Feb 22 '23 10:02 chhoumann