clerk icon indicating copy to clipboard operation
clerk copied to clipboard

alt key triggers full re-render of all components

Open sritchie opened this issue 2 years ago • 6 comments

there is something pretty weird going on on my clerk page, on version ec666210f11763fce4fec74072acca1e6525d29f.

If I press the alt (option on OS X) key on a clerk page, it seems to trigger a re-evaluation of everything on the page:

2022-12-15 14 22 29.

Notice that on pressing alt (weirdly it’s not showing keystrokes), both defonce forms change to nil result instead of their var.

Is this a React 18 thing?

sritchie avatar Dec 21 '22 01:12 sritchie

This must be the culprit: https://github.com/nextjournal/clerk/blob/6ca1ffd55e6fdae4cbeb7400f0f5cd79ddd4b086/src/nextjournal/clerk/render.cljs#L289-L292

I'm not sure what that option is doing, but it would be great to not force a re-render if we don't have to.

sritchie avatar Dec 21 '22 05:12 sritchie

@joe-loco , this comes from https://github.com/nextjournal/clerk/pull/186... I wonder if there is a way that we can prevent that new kv pair you're adding from triggering a re-render...

If you look at a page like https://jsxgraph.mentat.org/, pressing the alt key without doing anything else freezes the page as all of the heavyweight graphs re-render.

sritchie avatar Dec 21 '22 06:12 sritchie

@sritchie can you confirm this is no longer an issue?

mk avatar Feb 04 '23 18:02 mk

I failed to reproduce it so going to close it as I try to get an handle on the open issues. Please reopen if it's still a problem.

mk avatar Feb 05 '23 08:02 mk

I will give it a closer look Monday but I tried to recreate this Friday on the latest Clerk and couldn't do it. Thank you!

sritchie avatar Feb 05 '23 14:02 sritchie

This is back on the latest clerk (main)... notice the nil when I press option on my mac:

2023-02-16 15 05 26

sritchie avatar Feb 16 '23 22:02 sritchie