Skip to content
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

Docs: stackblitz migration #2524

Merged
merged 3 commits into from
Apr 27, 2024
Merged

Conversation

trongthanh
Copy link
Contributor

@trongthanh trongthanh commented Apr 26, 2024

Related Issues or Discussions

Fixes #2516

Summary

As per #2516, here's my first PR to migrate Codesandbox examples to Stackblitz. (This is my personal Github acc). While copying this particular SSR example, I found it quite irrelevant and failed to demonstrate the useHydrateAtoms which the example is placed at. Can I make change to the example to make it relevant and useful?

Check List

  • yarn run prettier for formatting code and docs

Copy link

codesandbox-ci bot commented Apr 26, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

vercel bot commented Apr 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jotai ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2024 4:55pm

@dai-shi
Copy link
Member

dai-shi commented Apr 26, 2024

Can I make change to the example to make it relevant and useful?

Yes, please.

@dai-shi
Copy link
Member

dai-shi commented Apr 26, 2024

You want to fix the code in markdown if needed.

@@ -1,6 +1,6 @@
export const Stackblitz = ({ id, file }) => {
return (
<div className="mb-8 overflow-hidden rounded-md border-b border-gray-200 shadow-lg dark:!shadow-none sm:rounded-lg">
<div className="mb-8 mt-4 overflow-hidden rounded-md border-b border-gray-200 shadow-lg dark:!shadow-none sm:rounded-lg">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandren in case you want to review it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this would add some top margin to the Stackblitz block to keep it from too close to the heading above.
Screenshot 2024-04-26 at 4 52 21 PM

@trongthanh
Copy link
Contributor Author

You want to fix the code in markdown if needed.

The related markdown looks fine and up to date. I'll try to rewrite the example code so that it make more sense.

Copy link

github-actions bot commented Apr 26, 2024

LiveCodes Preview in LiveCodes

Latest commit: 787f636
Last updated: Apr 26, 2024 4:55pm (UTC)

Playground Link
React demo https://livecodes.io?x=id/9AVMHKFV6

See documentations for usage instructions.

docs/utilities/ssr.mdx Outdated Show resolved Hide resolved
@trongthanh
Copy link
Contributor Author

I have made change to the markdown as suggested and revise the demo with same code sample at the SSR page to make it relevant and relatable. Please check the Stackblitz demo here.

@dai-shi
Copy link
Member

dai-shi commented Apr 26, 2024

Hm, I actually liked the timer clock demo, which is from the official example, AFAIR.
Is it something that you mention that doesn't make sense?

@trongthanh
Copy link
Contributor Author

trongthanh commented Apr 27, 2024

IMO, the clock demo is good as a client-side state binding demo but it didn't use useHydrateAtoms at all, which doesn't demonstrate how SSR works. I have ported the exact Clock codesandbox currently on Jotai website here. Maybe I missed something?

Even if I add the useHydrateAtoms to hydrate initialState from getServersideProps, the Clock component will discard it one second at the setInterval. This make it very confusing as a SSR demo.

@dai-shi
Copy link
Member

dai-shi commented Apr 27, 2024

I see. Yeah, I think the clock demo is not about hydration.

Can we keep both examples?
Your demo can be embedded, and the clock demo can be just a link.

@trongthanh
Copy link
Contributor Author

IMO, I will only embed the new demo (as in latest commit). For the Clock demo, I'll use it to replace the clock codesandbox on the Next.js guide. Plus, there's no need to add a link to the clock demo since this SSR page already has a link to the Next.js page.

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Please keep going. Thanks for your contribution!

@dai-shi dai-shi merged commit 723c276 into pmndrs:main Apr 27, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants