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(examples): Add Emotion example #1485

Merged
merged 14 commits into from
Feb 25, 2022

Conversation

helderberto
Copy link
Contributor

No description provided.

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 13, 2022

Hi @helderburato,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 13, 2022

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

examples/emotion/app/root.tsx Outdated Show resolved Hide resolved
@danestves
Copy link

Hi, can you test if this implementation works with Cloudflare Worker? I try it, but it's appearing that emotion is calling some packages that don't work in a worker

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time here!

Could you add one or two routes to make sure that it works across those route boundaries? And double-check that CatchBoundary and ErrorBoundary on the root route will work because I'm not certain it will.

@helderberto
Copy link
Contributor Author

helderberto commented Feb 9, 2022

Hey @kentcdodds!

If I catch this well, I added two new routes /jokes and /jokes/:id and a CatchBoundary to the root`. Is that what you expect?

The styles still working through the routes.


Ps.: I tested it in an incognito tab and working well, could you check it again? @kentcdodds,

If it's ok, I'll update example #1495 to the same approach.

@kentcdodds
Copy link
Member

My big concern is that if there's a CatchBoundary or an ErrorBoundary and those are rendered due to an error, all the styles will be removed because the App (where the styles are rendered) will be removed from the page. If you can verify that's not a problem then we can go forward with this. Otherwise we may need to come up with a different approach.

@helderberto
Copy link
Contributor Author

helderberto commented Feb 15, 2022

If I catch it well, I triggered a catch/error boundary into the jokes/:jokeId and jokes/not-found, like the following screenshots:
Screenshot 2022-02-15 at 09 29 43
Screenshot 2022-02-15 at 09 29 55

And the styles persist into the nested routes.

Is that what you expect @kentcdodds ?


If so, I can apply the same to the #1495

@kentcdodds
Copy link
Member

What if you have a CatchBoundary and ErrorBoundary in the root.tsx file and those are rendered? My guess is the styles will all be removed in that case because the App (which renders the styles) will be replaced by the CatchBoundary and the ErrorBoundary.

@kentcdodds
Copy link
Member

Here are more details on the issue with CSS-in-JS: #1512 (comment)

@helderberto
Copy link
Contributor Author

Hi @kentcdodds, I updated the project at the commit 7894b95.

The behavior looks like this:

Root Error

Screenshot 2022-02-17 at 09 08 44

CSS Rendered

Screenshot 2022-02-17 at 09 08 54

Is that the expected?

@kentcdodds
Copy link
Member

If it's server rendered then it works fine. But it breaks for client transitions. Can you try doing the same thing I'm doing in that video?

@ulentini
Copy link

I was able to reproduce the problem and it actually breaks the client, like with other CSS-in-JS libraries.
I was also able to fix it starting from @primos63 repo (where he fixed it for ChakraUI): https://github.com/primos63/chakra-remix-example

@helderburato, let me know if you want me to make a PR to your branch.

@helderberto
Copy link
Contributor Author

helderberto commented Feb 17, 2022

Based on your comments, I used the link @ulentini mentioned to fix the client-side issues.

Thanks, @ulentini for sharing the Chakra link.

@helderberto
Copy link
Contributor Author

What do you think about @kentcdodds ?

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

This is awesome! Could you have a section in the README that describes how the example works and why you need to interact with the cache? Also make reference to the relevant files in the example. Then this will be ready to merge. Thanks!

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Super 👍

This is very helpful. Thank you 👏👏

@kentcdodds kentcdodds merged commit 3317a1f into remix-run:main Feb 25, 2022
@helderberto helderberto deleted the emotion-example branch February 26, 2022 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants