Fork me on GitHub
#reagent
<
2022-12-21
>
Sam Ritchie01:12:07

I’m using Reagent 1.1.1 with React 18.2, via #C035GRLJEP8… I am noticing a strange behavior, maybe just on Clerk, where all of the components on the page re-mount if I press the option key. Is this something anyone has heard of??

p-himik09:12:29

Interesting, but I would definitely suspect a user error first. Maybe Clerk has some listeners for option and does something that leads to a re-mount? In the DevTools of a browser, you can show all event listeners attached to a particular element. I just took a brief look and seems like Clerk attaches event listeners for every result: https://github.com/nextjournal/clerk/blob/6ca1ffd55e6fdae4cbeb7400f0f5cd79ddd4b086/src/nextjournal/clerk/render.cljs#L289-L300 No clue though whether it's the culprit or not. But in the very same DevTools you can also remove those listeners. You can try removing them one by one in some small notebook and see whether it helps.

Sam Ritchie11:12:01

It’s only the alt / option key but for exactly the reason you note in the code… pressing alt sets a prop which triggers a re-render. Looks like this is a bug from trying to capture alt-click on certain forms. Thank you @U2FRKM4TW for the fast debugging!

👍 1