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

Toggling a task can give "Tasks: Could not find the correct task line to update" #3267

Open
4 of 8 tasks
claremacrae opened this issue Jan 9, 2025 · 3 comments
Open
4 of 8 tasks
Labels
scope: toggling tasks Issues with clicking on task checkboxes to complete them, or advance to the next status type: bug Something isn't working

Comments

@claremacrae
Copy link
Collaborator

claremacrae commented Jan 9, 2025

⚠️ Check issue is valid.

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

Steps to reproduce

  1. Download this vault:
  2. Expand the .zip file
  3. Open the error completing some tasks folder as a vault
  4. Trust the plugins
  5. Open the file Reproduction
  6. Follow the instructions in the file

Expected Behavior

The first of the - [ ] There is an identical copy of me lines is completed and gets a Done (✅) date

Current behaviour

Video recording of current behaviour:

error.completing.some.tasks.2.mp4

Description of current behaviour:

  1. An error message is displayed:

    image

  2. There is an error displayed in the Console:

    Tasks: Could not find the correct task line to update.
    
    The task line not updated is:
    >   - [ ] There is an identical copy of me
    
    In this markdown file:
    "Test 3.md"
    
    Note: further clicks on this checkbox will usually now be ignored until the file is opened (or certain, specific edits are made - it's complicated).
    
    Recommendations:
    
    1. Close all panes that have the above file open, and then re-open the file.
    
    2. Check for exactly identical copies of the task line, in this file, and see if you can make them different.
    

Which Operating Systems are you using?

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

Obsidian Version

1.8.1

Tasks Plugin Version

7.14.0

Checks

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

Possible solution

I have been trying to understand this on-and-off for a few days now.

I have some notes in which I have figured out the cause, and a likely fix.
For now, I need to move on to some other things, so once this issue is created, I will upload those notes here, so the info is not lost.

@claremacrae claremacrae added the type: bug Something isn't working label Jan 9, 2025
@claremacrae
Copy link
Collaborator Author

I have some notes in which I have figured out the cause, and a likely fix.
For now, I need to move on to some other things, so once this issue is created, I will upload those notes here, so the info is not lost.

3267 - bug - could not find the correct task line to update.md

@claremacrae claremacrae added the scope: toggling tasks Issues with clicking on task checkboxes to complete them, or advance to the next status label Jan 9, 2025
@claremacrae
Copy link
Collaborator Author

I have added a video recording to the "Current behaviour" section above...

@claremacrae
Copy link
Collaborator Author

I have some notes in which I have figured out the cause, and a likely fix.
For now, I need to move on to some other things, so once this issue is created, I will upload those notes here, so the info is not lost.

3267 - bug - could not find the correct task line to update.md

I have also pushed the branch where I was experimenting on this issue:

spike-issue-3267-could-not-find-correct-task

A rough list of the changes it contains:

  • Tasks plugin's data.json is edited to turn on:
    • a lot of console output
    • and debug visualisation of stored task location information
  • Cache.indexFile() shows a key debug line as an error, so it is shown in red, to make it easier to see the structure in console output
  • File.ts has lots more info in debug output
  • InlineRenderer.ts and QueryResultsRenderer.ts have a sketch of what a future LineNumberResolver might look like
    • See references to ChatGPT in my linked notes above
  • More readable display for the debug visualisation of stored task location information:
    • TaskLineRenderer.ts uses span and a named class for styling
    • Renderer.scss styles that named span
  • TaskLineRenderer.ts
    • Calls LineNumberResolver - see above
    • Has comments explaining issues with the current line-number being out-of-date sometimes, by the time the callback for toggling a task in Reading more is executed
  • File.test.ts has a smoke test showing how this failure to find the correct task line is reached.

claremacrae added a commit that referenced this issue Jan 9, 2025
This is a temporary workaround for #3267, which I discovered whilst testing on this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: toggling tasks Issues with clicking on task checkboxes to complete them, or advance to the next status type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant