Codesandbox sample app review
We're using codesandbox hosted sample applications in several places in our docs. We need to review all of these to:
- Make sure they're all still working properly; we've noticed some strangeness with
graphql@16that is causing them to break. - Make sure they're all moved over the
apollographqlcodesandbox org. - Make sure the codesandbox links in the docs are all still pointing to valid sample apps.
I'm going to link to this issue which had a problem on Code sandbox
https://github.com/apollographql/apollo-client/issues/9846
Also linking to our docs example repo which @StephenBarlow mentioned can be used to back individual sandboxes so we can update them via PRs https://github.com/apollographql/docs-examples 🎉
Here's another issue related to this https://github.com/apollographql/apollo-client/issues/9659 (shoutout alessia!)
@alessbell fix in this thread worked. Some changes we can make to the error-template repo:
-
The
graphql@16module seems to not transpile correctly on codesandboxes, see this for example. I think we can just revert graphql back down to 15.x until this is fixed -
Codesandbox seems to no longer want
*.jsxfiles as entrypoints, though I can't find this actually written anywhere. Very strange. Given that the fullstack tutorial uses Typescript, I think we can kill two birds with one stone and convert theindex.jsxfile to anindex.tsxfile, both letting it actually render, and putting it in a language which most apollo-client users are probably using anyways.
CC @hwillson
Edit: Regarding issue 9659, everything seems to be an issue with codesandbox. Downloading the CS to local and running works fine.
@MrDoomBringer just curious on this finding:
The graphql@16 module seems to not transpile correctly on codesandboxes, see this for example. I think we can just revert graphql back down to 15.x until this is fixed
Is this something we should make someone at Codesandbox aware of? Do we feel it's an issue on their end?
@jpvajda great question! Given that this only affects versions after 16, I suspect it's an issue on the graphql module's end. I went ahead and opened an issue here. Let me know if you feel otherwise and I'll be happy to open an issue on Codesandbox as well, though!
PR for this open here. I went with the slightly more elegant solution of just manually setting index.jsx as the entrypoint for the project.
There was talk of create-react-app not supporting *.jsx as a default entrypoint here many moons ago, and I suspect they may have made good on that claim.
There was talk of create-react-app not supporting *.jsx as a default entrypoint https://github.com/facebook/create-react-app/issues/3052 many moons ago, and I suspect they may have made good on that claim.
Does that mean we need to use this workaround? https://github.com/facebook/create-react-app/issues/3052#issuecomment-330868560
Does that mean we need to use this workaround
Nope! We can just set "main":"index.jsx" in the package.json, which feels more straightforward.
Moving the error-template repository over to our docs-examples repo with this PR: https://github.com/apollographql/docs-examples/pull/48
@MrDoomBringer I believe we can close this out now that all code sandboxes have been updated. Thanks for all of your work on this!