-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gensym / anonymous function syntax breaks fast refresh #117
Comments
Thanks for the report. I haven't tested this, but since it's the (defnc my-component
[]
(hooks/use-effect [] (my-thing-that-generates-some-bindings-internally))
,,,) The code used by Based on my reading here https://github.com/clojure/tools.reader/blob/fb185af411fa379e48e5d0a9e623b68f552d8c92/src/main/clojure/clojure/tools/reader.clj#L528-L532 I think that detecting the PR welcome! |
FYI I had a similar issue in UIx, here's the fix, perhaps it can help pitch-io/uix@7c39a4e |
Simple reproduction that will cause fast refresh to always do a full reload:
It will be fixed by using
(fn [%] (identity %))
instead. The problem is that on each reload the gensym'd binding that replaces%
is changed. Compare:I don't have an clear idea on how to best fix this. If there was a way to detect & remove gensym'd symbols, that would be ideal. I don't know think that's possible at all.
The anonymous function syntax seems likely to be the most common (only? is this something that can only happen from syntax, or could a macro cause it too?) cause of this and it will always end its binding with
#
, or you could pick up on the prefix ofp\d+__
for that case, too.The text was updated successfully, but these errors were encountered: