-
Notifications
You must be signed in to change notification settings - Fork 79
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
Upgrade to React 18.2 and add thin cljs hooks layer #242
Conversation
@borkdude sci doesn't support |
@mk Async function in JS just means:
You can achieve the same in SCI using promesa. |
@borkdude did you see the error above? Not sure what the differences are, we are currently returning a promise but it suggests |
@mk Can you show me where that error is? I'll be able to take a deeper look in an hour or so |
@borkdude you get it locally on the console when showing the vega or plotly sample notebook. |
@mk Right, I don't know if there is a flag to "toggle" a function's asyncness, but wrapping it inside an async function which awaits the inner promise might work then. |
This hack may also work: cljs.user=> (def sci-fn (sci/eval-string "(fn [] (js/Promise.resolve 10))" {:classes {'js js/globalThis :allow :all}}))
#'cljs.user/sci-fn
cljs.user=> (def async-constructor (js/eval "(async function () {}).constructor"))
#'cljs.user/async-constructor
cljs.user=> (set! (.-constructor sci-fn) async-constructor)
#object[AsyncFunction]
cljs.user=> (sci-fn)
#object[Promise [object Promise]] |
@mk I believe you're seeing that error because |
In 95b0db1 I added a thin layer over react hooks for more ergonomic cljs usage:
|
@mhuebert looks fantastic, thank you! |
# Conflicts: # resources/viewer-js-hash
This upgrades React to 18.2 and adds a thin layer over react hooks for more ergonomic cljs usage:
useEffect
returns js/undefined for any non-function valueuseState
anduseRef
return values that behave like atoms