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

Cannot add dependencies via API's createTaskLineModal(): "Blocking and blocked by fields are disabled when vault tasks is empty" #2993

Open
3 of 7 tasks
Shojua opened this issue Jul 30, 2024 · 1 comment
Labels
scope: edit task The Create or edit task modal/dialog scope: scripting Issues to do with custom filters, custom sorting and similar scope: task dependencies Anything to do with making tasks aware of other tasks type: bug Something isn't working

Comments

@Shojua
Copy link

Shojua commented Jul 30, 2024

Please check that this issue hasn't been reported before.

  • I searched previous Bug Reports didn't find any similar reports.

Expected Behavior

I’m using the Tasks Plugin together with the QuickAdd Plugin to create tasks using a shortcut. When I use this shortcut, it should open the task creation interface, allowing me to make changes just like I normally would.

Current behaviour

When I use the shortcut, the fields for "Before This" and "After This" are replaced with the message "Blocking and blocked by fields are disabled when vault tasks is empty," and I can’t modify the dependencies in the creation menu. However, it works fine if I create the task first and then edit it afterward.

image

Steps to reproduce

  1. Create the QuickAdd Shortcut just like the one in the documentation
  2. Use the QuickAdd Shortcut

Which Operating Systems are you using?

  • Android
  • iPhone/iPad
  • Linux
  • macOS
  • Windows

Obsidian Version

1.6.7

Tasks Plugin Version

7.6.1

Checks

  • I have tried it with all other plugins disabled and the error still occurs

Possible solution

No response

@Shojua Shojua added the type: bug Something isn't working label Jul 30, 2024
@claremacrae claremacrae added scope: scripting Issues to do with custom filters, custom sorting and similar scope: edit task The Create or edit task modal/dialog labels Jul 30, 2024
@claremacrae claremacrae changed the title "Blocking and blocked by fields are disabled when vault tasks is empty" Cannot add dependencies via API's createTaskLineModal(): "Blocking and blocked by fields are disabled when vault tasks is empty" Jul 30, 2024
@claremacrae claremacrae added the scope: task dependencies Anything to do with making tasks aware of other tasks label Jul 30, 2024
@claremacrae
Copy link
Collaborator

This should have been stated in the docs, that it is a known issue. Thank you for logging it.

The reason behind the current behaviour is written up in the TODO comment here:

export const defaultTaskModalFactory: taskModalFactory = (
app: App,
onSubmit: (updatedTasks: Task[]) => void,
): ITaskModal => {
const task = taskFromLine({ line: '', path: '' });
// TODO This is going to need some thought. It is missing the Cache argument.
// This file is part of the Tasks API that allows users to open the Edit Task modal from JavaScript:
// https://publish.obsidian.md/tasks/Advanced/Tasks+Api
// As a published API, to change the parameters would be a breaking change.
// One option is to make the allTasks parameter to the Edit task modal be optional,
// and if it's not provided, then hide the dependency fields in the modal.
// For now, we pass in an empty list of tasks.
return new TaskModal({ app, task, onSubmit, allTasks: [] }) as ITaskModal;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: edit task The Create or edit task modal/dialog scope: scripting Issues to do with custom filters, custom sorting and similar scope: task dependencies Anything to do with making tasks aware of other tasks type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants