generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 302
Open
Labels
scope: for plugin developersTools for use by plugin developers, including the Tasks APITools for use by plugin developers, including the Tasks APItype: bugSomething isn't workingSomething isn't working
Description
⚠️ Check issue is valid.
- My request is about the Tasks plugin for Obsidian.
- I have tested the bug with the latest version of the Tasks plugin.
⚠️ Check that this issue hasn't been reported before.
- I searched previous Tasks plugin Bug Reports didn't find any similar reports.
Steps to reproduce
- Open Obsidian with the Tasks plugin enabled.
- Open the Developer Console (Ctrl+Shift+I / Cmd+Opt+I).
- Paste and run the following snippet:
const tasksApi = app.plugins.plugins["obsidian-tasks-plugin"].apiV1;
(async () => {
console.log("[TEST] before modal");
const result = await tasksApi.editTaskLineModal("- [ ] test");
console.log("[TEST] after modal:", JSON.stringify(result), "length:", result.length);
})();
- In the modal that opens:
Case A: Enter a start date and click Apply → console logs the edited line.
Case B: Leave out the start date and click Apply → console logs the edited line without 🛫.
Case C: Click Cancel → console shows [TEST] before modal but never logs [TEST] after modal. The promise never resolves.
Expected Behavior
According to the Tasks API documentation, editTaskLineModal() should always resolve:
- Return the edited line if Apply is clicked.
- Return an empty string "" if Cancel is clicked.
Current behaviour
- Clicking "Apply" with or without start date works as expected.
- Cancel leaves the promise unresolved. No value is returned, and the awaiting code never resumes.
Impact
- Scripts and QuickAdd macros that rely on editTaskLineModal cannot detect someone clicking "Cancel".
- This causes workflows to hang or terminate unexpectedly, since the promise never resolves.
Which Operating Systems are you using?
- Android
- iPhone/iPad
- Linux
- macOS
- Windows
Operating System Version(s)
11
Obsidian Version
1.9.14
Tasks Plugin Version
7.22.0
Checks
- I have tried it with all other plugins disabled and the error still occurs
Possible solution
Adjust the modal’s cancel handler so that it explicitly calls the promise resolver with "".
Metadata
Metadata
Assignees
Labels
scope: for plugin developersTools for use by plugin developers, including the Tasks APITools for use by plugin developers, including the Tasks APItype: bugSomething isn't workingSomething isn't working