lilactown / helix

A simple, easy to use library for React development in ClojureScript.
Eclipse Public License 2.0
627 stars 52 forks source link

"Provider" property access getting mangled by :optimizations :advanced #103

Closed aiba closed 12 months ago

aiba commented 2 years ago

I was chasing down an issue in our app that was only occuring with :optimizations :advanced and I think it's this line where it calls (.-Provider ~context). I think the compiler needs the ^js hint on the context variable.

PR forthcoming.

lilactown commented 2 years ago

Is there a way for me to reproduce the issue @aiba ? I don't think the PR you opened would break anything, but I'd like to have some way to test this.

aiba commented 2 years ago

I tried to make a small example app to reproduce, but in the small app I couldn't compel the clojurescript compiler to munge the "Provider" name. But I'm sure it happens in my larger app, because I spent a lot of time inspecting the generated, optimized javascript, and my fix in #104 fixes it in my larger app. I wish I could give you an easy way to reproduce, but I would ask that you accept the change based on the way macros emit metadata, as discussed in the two links in the comments on #104.

aiba commented 1 year ago

This bug reappeared on our most recent build, and I just confirmed that #109 did not fix it.

I think we need to declare the type-hinted symbol outside of the syntax-quote. See the comments on #104 (which is a working fix).

lilactown commented 1 year ago

PR welcome. Can we test for this somehow?

lilactown commented 1 year ago

See https://github.com/lilactown/helix/blob/46b81fc656af480e8e588f87def10da9b114fb04/test/helix/core_test.cljs#L69-L72 for how I think we could test this