CodeblockCustomizer icon indicating copy to clipboard operation
CodeblockCustomizer copied to clipboard

Tasks code block keeps unfolding

Open conservative-dude opened this issue 1 year ago • 3 comments

Hi,

I use Obsidian 1.6.5 with CodeBlock Customizer and Tasks plugins. I have this weird behaviour in Live Preview when tasks codeblock keeps filling up with duplicated values from the tasks query and then cleaning up the duplicated values. It happens only when the current file also has some tasks.

I have disabled tasks in CodeBlock Customizer but the issue is still there.

Screenshot 2024-07-05 at 11 43 06

To reproduce: Step1 Create a file Tasks with

- [ ] Task 1
	- [ ] Task 2
	- [x] Task 3
	- [ ] Task 4
- [x] Task 6
- [ ] Task 7

Step2 Create an Example file with

Tasks

\```tasks
path includes Tasks
\```

# About yesterday
Some summary
- 1
- 2

# Plan for today
- [ ] 

and try to open it in Live Preview. If you'll try to add anything into "About yesterday" list, you will see the tasks codeblock flicking.

When I disable CodeBlock Customizer plugin, this issue no longer happens.

https://github.com/mugiwara85/CodeblockCustomizer/assets/55538308/caac2373-f5ae-44e0-b4c1-413f849560cb

conservative-dude avatar Jul 05 '24 11:07 conservative-dude

Hi! I will look into it, and get back to you. There were 2 other people who had problems with the Tasks plugin(#55, #71) , but none of them provided detailed steps to reproduce the issue. Did you notice any other problems with the tasks plugin?

mugiwara85 avatar Jul 05 '24 13:07 mugiwara85

haha thanks @mugiwara85

Pls do note that the issue happens only there are tasks in the note itself (like in my example if I remove the task from 'Plan for today' section, the issue is gone.

I haven't noticed any other issues with the tasks plugin but I tried another plugin for code blocks (Code Styler) and I ran into exactly same issue, so i guess your plugin and that one share some common root cause.

conservative-dude avatar Jul 05 '24 15:07 conservative-dude

Hi @conservative-dude I had finally some time to look at this. Unfortunately, I was not able to determine what is causing this behavior, but it is either an Obsidian bug, or a bug in the Tasks plugin. The only thing I know, is that if I uncomment in my plugin:

this.registerMarkdownPostProcessor(async (el, ctx) => {
      await calloutPostProcessor(el, ctx, this)
    });

Then this behavior does not happen. The function I uncomment processes callouts. I also have another function which is the Reading view itself, but it also uses some common function as calloutPostProcessor. I don't do anything (not that I know of) which could trigger this behavior.

My advice would be, to open an Issue with Tasks plugin creator to have a look at it. Maybe he can narrow it down.

I am happy to help, but first I need to know, what is actually the problem, and I don't see anything on my side.

mugiwara85 avatar Jul 28 '24 21:07 mugiwara85

Maybe he can narrow it down.

She... 😄

Someone has just logged this in Tasks too:

  • https://github.com/obsidian-tasks-group/obsidian-tasks/issues/3047

I don't generally work on issues involving other plugins unless the other author is willing and able to work jointly on the problem, screen sharing and investigating together.

So @mugiwara85, if you are able to share half an hour to have a first investigation of this, please email me (address in account profile here) and we can set up a time, and I'll send a Zoom invite.

It would need to be in the next two weeks, though. That's when I have some time available.

claremacrae avatar Aug 22 '24 08:08 claremacrae

Maybe he can narrow it down.

She... 😄

Someone has just logged this in Tasks too:

  • https://github.com/obsidian-tasks-group/obsidian-tasks/issues/3047

I don't generally work on issues involving other plugins unless the other author is will and able to work jointly on the problem, screen sharing and investigating together.

So @mugiwara85, if you are able to share half an hour to have a first investigation of this, please email me (address in account profile here) and we can set up a time, and I'll send a Zoom note.

It would need to be in the next two weeks, though. That's when I have some time available.

Sorry, about that 😀 Yes, no problem. I will contact you via email. Thanks for trying to fix it!

mugiwara85 avatar Aug 22 '24 08:08 mugiwara85

Good to meet you @mugiwara85 😄

Here's a link to the notes I made after today's pairing session:

https://github.com/obsidian-tasks-group/obsidian-tasks/issues/3047#issuecomment-2308444760

See you next Sunday...

claremacrae avatar Aug 24 '24 16:08 claremacrae

Issue identified. Working on solution! Problem is caused by a simple sleep statement. Not exactly sure why, but will look for another solution. https://github.com/mugiwara85/CodeblockCustomizer/blob/2e4b5b370445afe795d85c2bfb9aa91605aeb87f/src/ReadingView.ts#L148

mugiwara85 avatar Sep 01 '24 13:09 mugiwara85

@conservative-dude I just pushed a fix for this. If you want to try it out, you can take the main.js and styles.css files and overwrite yours with it (after you created a backup first). The problem should be solved now, but I would be grateful if you could verify that. Note: There are some changes regarding line and text highlighting which are not yet released, but the current main.js file already contains it, so don't wonder what happened with that :D

mugiwara85 avatar Sep 01 '24 22:09 mugiwara85

Fixed in version 1.2.8

mugiwara85 avatar Sep 23 '24 20:09 mugiwara85