replicant icon indicating copy to clipboard operation
replicant copied to clipboard

`:rendering?` not reset on error

Open gaverhae opened this issue 6 months ago • 1 comments

Raised by tianshu on Slack, I'm just reproducing it here so it doesn't get lost. Original description by tianshu:

How replicant detects whether render is triggered in another trigger? In my case I introduced a timer to implement a countdown stuff, and when some error happended , it considers all subsequent renders triggered in render, which is not correct.

Confirmation message from @cjohansen:

I've seen this as well, it's likely a bug. If an error is thrown during rendering (eg by an alias), Replicant doesn't update its internal "currently rendering" signal. Feel free to file a github issue so I don't forget it :sweat_smile:

From the description I imagine the issue is that, if an error happens between lines 224 and 233 of this snippet, :rendering? incorrectly stays true:

https://github.com/cjohansen/replicant/blob/4059a4aea00ad40698781a93fd16b78e7735a365/src/replicant/dom.cljs#L223-L234

But I could be completely off base here, this is my first look at the replicant code base itself.

gaverhae avatar Jun 17 '25 14:06 gaverhae

You're right about that. There needs to be a try/catch here so Replicant can recover from errors. It probably also needs to throw away its vdom, as it will have become corrupted by being interrupted.

cjohansen avatar Jun 21 '25 05:06 cjohansen