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

Edit Task modal sometimes fails to create all IDs when adding several dependencies #3252

Open
3 of 8 tasks
claremacrae opened this issue Dec 30, 2024 · 0 comments
Open
3 of 8 tasks
Labels
scope: edit task The Create or edit task modal/dialog scope: task dependencies Anything to do with making tasks aware of other tasks type: bug Something isn't working

Comments

@claremacrae
Copy link
Collaborator

claremacrae commented Dec 30, 2024

⚠️ Check issue is valid.

⚠️ Check that this issue hasn't been reported before.

Steps to reproduce

  1. Create a note with the following content
- [ ] #task -9 days ⏳ 2024-12-21
- [ ] #task -8 days ⏳ 2024-12-22
- [ ] #task -7 days ⏳ 2024-12-23
- [ ] #task -6 days ⏳ 2024-12-24
- [ ] #task -5 days ⏳ 2024-12-25
- [ ] #task -4 days ⏳ 2024-12-26
- [ ] #task -3 days ⏳ 2024-12-27
- [ ] #task -2 days ⏳ 2024-12-28
- [ ] #task -1 days ⏳ 2024-12-29
- [ ] #task 0 days ⏳ 2024-12-30
  1. Put the cursor on the 0 days (middle) task.
  2. Run the command Tasks: Create or edit task
  3. Click in the Before this field and select -9 days
  4. Click in the Before this field and select -8 days
  5. Click in the Before this field and select -7 days
  6. Click in the Before this field and select -6 days
  7. Click Apply

Expected Behavior

  • All 4 chosen tasks have a new ID value.
  • And 0 days has a depends on value of all 4 of the new IDs.
  • Editing the 0 days task again should show all 4 of the added dependencies:
    image
- [ ] #task -9 days 🆔 zrnvys ⏳ 2024-12-21
- [ ] #task -8 days 🆔 ebxr1s ⏳ 2024-12-22
- [ ] #task -7 days 🆔 jio0x7 ⏳ 2024-12-23
- [ ] #task -6 days 🆔 ylrplh ⏳ 2024-12-24
- [ ] #task -5 days ⏳ 2024-12-25
- [ ] #task -4 days ⏳ 2024-12-26
- [ ] #task -3 days ⏳ 2024-12-27
- [ ] #task -2 days ⏳ 2024-12-28
- [ ] #task -1 days ⏳ 2024-12-29
- [ ] #task 0 days ⛔ zrnvys,ebxr1s,jio0x7,ylrplh ⏳ 2024-12-30

Current behaviour

  • Some errors are usually displayed:
    image
  • And usually at least one task is missing a new ID value.
  • Editing the 0 days task shows one of the requested dependencies was not added:
    image
- [ ] #task -9 days 🆔 zrnvys ⏳ 2024-12-21
- [ ] #task -8 days 🆔 ebxr1s ⏳ 2024-12-22
- [ ] #task -7 days ⏳ 2024-12-23
- [ ] #task -6 days 🆔 ylrplh ⏳ 2024-12-24
- [ ] #task -5 days ⏳ 2024-12-25
- [ ] #task -4 days ⏳ 2024-12-26
- [ ] #task -3 days ⏳ 2024-12-27
- [ ] #task -2 days ⏳ 2024-12-28
- [ ] #task -1 days ⏳ 2024-12-29
- [ ] #task 0 days ⛔ zrnvys,ebxr1s,jio0x7,ylrplh ⏳ 2024-12-30

Which Operating Systems are you using?

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

Obsidian Version

1.8.0

Tasks Plugin Version

7.14.0

Checks

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

Possible solution

I believe that the code is writing one task at a time, so potentially 5 writes in quick succession in this example.
And Obsidian does not always keep with updating its cache.

Ideas:

  1. Changing the file-writing code in File.ts to use vault.process() might help:
const fileContent = await vault.read(file); // TODO: replace with vault.process.
  1. Try to rewrite all the tasks in the file on one go, instead of one write per task being edited
  2. Consider using mnaoumov/obsidian-dev-utils for all file reading and writing processes.
@claremacrae claremacrae added type: bug Something isn't working scope: task dependencies Anything to do with making tasks aware of other tasks scope: edit task The Create or edit task modal/dialog labels Dec 30, 2024
@claremacrae claremacrae changed the title Edit Task modal sometimes fails to create IDs when adding several dependencies Edit Task modal sometimes fails to create all IDs when adding several dependencies Dec 30, 2024
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: 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

1 participant