obsidian-tasks-group / obsidian-tasks

Task management for the Obsidian knowledge base.
https://publish.obsidian.md/tasks/
MIT License
2.37k stars 224 forks source link

Visual bug / incompatibility with some codeblock plugins #3047

Closed ndit-dev closed 1 week ago

ndit-dev commented 3 weeks ago

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

Expected Behavior

When a tasks query displays tasks and one task is edited, the tasks query should update accordingly.

Screen recording click to play TASKS_expectedBehaviour

Current behaviour

When a codeblock plugin like Obsidian-Code-Styler or CodeblockCustomizer is enabled in the same vault, a visual bug occurs in tasks queries during loading or updating. Tasks load slower than expected, and all the tasks in the query is temporarily loaded under the tasks query field causing the contonent on the page to jump/flicker during the load.

This issue likely affects other plugins that apply themes to codeblocks. While this bug is being reported here first due to multiple conflicting plugins causing the behavior, it may not be caused by or fixable through Obsidian-tasks.

Screen recording click to play TASKS_currentBehaviour

Steps to reproduce

  1. create a vault
  2. install and enable Code Styler and/or Codeblock Customizer community plugins.
  3. install and enable Tasks community plugin
  4. create a new note containing
    
    - [ ] EDIT ME TO to trigger bug/incompability!
  1. Switch to Live Preview
  2. Edit a few characters on the EDIT ME task line, and observe the flickering update

or download this example vault testTasksVisualBug.zip

Which Operating Systems are you using?

Obsidian Version

1.6.7

Tasks Plugin Version

8.9.0

Checks

Possible solution

Don't use the conflicting plugins.

claremacrae commented 3 weeks ago

Hi,

Reproduction

thanks for including a sample vault to download, videos and steps to reproduce.

In the Zipped vault, I was only able to reproduce the bug in Live Preview.

So I've added steps 5 and 6 to the repro, for completeness.

Issues involving other plugins

This issue likely affects other plugins that apply themes to codeblocks. While this bug is being reported here first due to multiple conflicting plugins causing the behavior, it may not be caused by or fixable through Obsidian-tasks.

I appreciate your transparency here.

As noted in https://publish.obsidian.md/tasks/Support+and+Help/Report+a+Bug#Bug+involving+another+plugin:

We do not generally work on problems of Tasks interacting with other plugins unless the author of that plugin is willing to work jointly on the problem.

Other reports

Someone has logged it already:

CodeblockCustomizer, which has 19,000 downloads:

I'll pop a note in the first of those, seeing if the author wants to spend half an hour together investigating.

claremacrae commented 3 weeks ago

@ndit-dev Please try and reproduce it in a dataview code block.

That will be useful info... Thanks.

claremacrae commented 3 weeks ago

@ndit-dev Also please try and narrow down minimum requirements to reproduce the problem.

For example, is it signification that you have both the task and query in the same note?

Or, what happens when they are in separate notes - is there still a problem? If so, what modes (Source, Live Preview, Reading) would those notes need to be in, to reproduce the problem?

claremacrae commented 3 weeks ago

Is it also significant that you have more tasks after the Tasks code block?

ndit-dev commented 3 weeks ago

Hi Claremacrae, thanks for looking into this. I understand that this issue is particularly difficult to troubleshoot, as it's caused by interactions with other plugins. Great find on the bug report with CodeStyler—I had only looked into the reports for CodeblockCustomizer since that's the one I usually use.

Please try and reproduce it in a dataview code block. That will be useful info... Thanks.

I wasn’t able to reproduce this with dataview. In fact, I was using dataview queries as a workaround until I started using recurring tasks, where the native tasks query is required. That's when I began to investigate the issue more closely.

For example, is it significant that you have both the task and query in the same note? Or, what happens when they are in separate notes—is there still a problem? If so, what modes (Source, Live Preview, Reading) would those notes need to be in to reproduce the problem? Is it also significant that you have more tasks after the Tasks code block?

It's not significant where the tasks are placed in relation to the query; they don't even need to be in the same note or visible in the query filter. The core issue isn’t with task editing itself—it's with the query loading. The problem just becomes more apparent when you edit a task in the same note since doing so causes the query to reload, which in turn makes the block flicker.

The issue is visible even when you simply open a note containing just a tasks query. However, it will only flicker once during the initial load of the note. This becomes more noticeable if the task list in the query is large. Any change to a task—such as editing, adding, or removing a task in another note—will cause it to flicker in this case. Even marking a task as done within the query will trigger this behavior.

As for which modes this occurs in, I’ll need to double-check. I typically work in live preview mode, and that's the only mode I've tested this in so far. I'm on my phone right now, but I'll check tomorrow.

ndit-dev commented 3 weeks ago

The visual bug and flicker is indeed only happning in editing mode, in reading mode it works perfectly and as intended.

Here is a screen recording that better visualizes that it's the query loading that is acting up. Here i first switch between two notes, then enable one of the plugins and do the same thing again to illustrate the differense. Obsidian_S8I8rXwSiu

claremacrae commented 2 weeks ago

@mugiwara85 and I spent around 1.5 hours on this today...

My notes from this:

Tasks plugin experiments

What is the behaviour of Tasks plugin when Codeblock Customizer is enabled?

Markdown task lines rendered in Reading mode

Markdown task lines rendered in Live Preview

Tasks query blocks, in Reading mode and Live Preview

Video of the above observations:

https://github.com/user-attachments/assets/5c9cbf17-145d-4645-9fe9-e5e6e02910de

Does updating the Tasks plugin to the latest Obsidian API fix the problem?

Codeblock Customizer

ndit-dev commented 2 weeks ago

I can confirm that everything mentioned under "What is the behaviour of Tasks plugin when Codeblock Customizer is enabled?" above aligns with my testing to. Good and thorough description of the behavior 👍

claremacrae commented 1 week ago

@mugiwara85 has identified the location of the problem - see https://github.com/mugiwara85/CodeblockCustomizer/issues/96#issuecomment-2323337785.

The next challenge is to find the solution - but this confirms it isn't a problem with the Tasks code, so I'm closing this ticket.