-
Notifications
You must be signed in to change notification settings - Fork 50
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
Update package-set to 0.15.4-20220808 and react dependency #294
Update package-set to 0.15.4-20220808 and react dependency #294
Conversation
Necessary to allow the latest react version v18 can be used cookbook examples
A bit of additional context: The first migrated react v18 example isn't working, and my assumption is it will start doing that after updating the package set. It can be tested before and after with this link: Current State |
I think the real culprit is the import map. See https://github.com/purescript/trypurescript/blob/master/client/public/frame.html#L28-L30 |
Oha, I didn't know this is the way JS dependencies are provided. Pushed 257c1bf
I assume both are valid issues. JS needs to be updated (otherwise JS error at runtime) and PureScript bindings available (the latter currently fails at compile time). |
I still need to try this out locally to verify it works, but I don't see why it wouldn't. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I build this locally, I get an error of Unknown module React.Basic.DOM.Client
when I try to run the cookbook repo's HelloReactHooks example:
module HelloReactHooks.Main where
import Prelude
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Exception (throw)
import React.Basic.DOM as R
import React.Basic.DOM.Client (createRoot, renderRoot)
import React.Basic.Hooks (Component, component)
import Web.DOM.NonElementParentNode (getElementById)
import Web.HTML (window)
import Web.HTML.HTMLDocument (toNonElementParentNode)
import Web.HTML.Window (document)
main :: Effect Unit
main = do
doc <- document =<< window
root <- getElementById "root" $ toNonElementParentNode doc
case root of
Nothing -> throw "Could not find root."
Just container -> do
reactRoot <- createRoot container
app <- mkApp
renderRoot reactRoot (app {})
mkApp :: Component {}
mkApp = do
component "App" \_ -> React.do
pure (R.text "Hello!")
I'm not sure why. I won't be able to look into this further today.
Hi there, I tried it out locally, too. It took some time to install both the whole Haskell and PureScript world before being able to run it, but it was worth it. It looks like another export for the subdirectory was missing to be able to execute the new react examples: Here is a screenshot of trypurescript working with the example in Chrome and Firefox. @JordanMartinez However, I do not think this is the error you mentioned. "Unknown module React.Basic.DOM.Client" is the PureScript error that this PR should fix by updating the package set. I did not encounter it myself locally - even before the importmap fix. Instead - if I had to guess - I would double check the branch is correct, the build is done and spago's cache was updated. Let me know if you still encounter it. |
I think the issue was caused by me running the wrong |
This tells me it's likely something on my end. I'm nuking things and will see how things go from there. |
I think it has to be the
|
Yup! |
@@ -18,16 +18,17 @@ | |||
</script> | |||
<!-- | |||
JSPM Generator Import Map | |||
Edit URL: https://generator.jspm.io/#Y2NhYGCzD80rySzJSU1hSMpM183MK0lNTy1yMNQz0zM1ZEhJTc7MTczRyyp2MDTQM9YzZChKTUwu0U3Jz3UwNNcz0DPCENAvTi0qSy2CiMMUlZZmpjhYAA0wAgA6XlZ2dAA | |||
Edit URL: https://generator.jspm.io/#ZcxBDkAwEEDRWQinMQwhlr2EA9BOZKQqqamtq5OIle1L/s8zgOIag4p6djDLUkpQXjgawh47AsdWtsnjehiqsUWCyJPV0u2boQEbrH9QWS8c9O8Hx5Pj61+ckjgzPOPmBszFaRmMAA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a bug with jspm
right now. This URL doesn't actually open anything for me. However, if I navigate to the above URL and then navigate to https://generator.jspm.io, then it shows what the URL should have displayed. 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your work!
Try PS was redeployed, but I'm getting this error when I run the
|
Undoing #295 locally fixes the issue. Ugh... |
@andys8 Since I seem to have bad luck with my environment, can you confirm the above? Both that |
* Update package-set (same as try.purescript.org) See <purescript/trypurescript#294> * Update BookReactHooks * Update ButtonsReactHooks * Update CardsReactHooks * Update CatGifsReactHooks * Update ClockReactHooks * Update ComponentsInputReactHooks * Update ComponentsMultiTypeReactHooks * Update ComponentsReactHooks * Update DragAndDropReactHooks * Update FileUploadReactHooks * Update FormsReactHooks * Update GroceriesReactHooks * Update ImagePreviewsHalogenHooks * Update NumbersReactHooks * Update PositionsReactHooks * Update RoutingHashReactHooks * Update RoutingPushReactHooks * Update ShapesReactHooks * Update TextFieldsReactHooks * Update TicTacToeReactHooks * Update TimeReactHooks
Description of the change
Update to the latest package-set. Necessary to allow the latest react version v18 can be used cookbook examples
Checklist: