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

SSR with Remix #1618

Open
imsteev opened this issue Feb 19, 2023 · 3 comments
Open

SSR with Remix #1618

imsteev opened this issue Feb 19, 2023 · 3 comments
Labels
help-wanted An issue that needs additional investigation or community feedback to resolve question A question around API, functionality, etc.

Comments

@imsteev
Copy link

imsteev commented Feb 19, 2023

Hi, I'm using evergreen in a server side app. When I render something like this:

<Pane marginTop="32px" />

the first render of my page does not have the desired spacing. Further investigation led me to realize that the class ".ub-mt_32px" is not included in the css sheet that comes from extractStyles(). But upon the second load, this class is in the stylesheet.

Why would this be happening and how/why would margin classes generate dynamically?

I may be missing something regarding SSR in general, this is the first app I've explored doing it with.


My workaround at the moment is to directly apply a style prop:

<Pane style={{ marginTop: '32px' }} />
@brandongregoryscott
Copy link
Contributor

Hey @imsteev, I'm not super well-versed in SSR either, but you shouldn't need to use the style prop directly (and this will likely interfere with certain components & their styling).

I'm assuming you've taken a look at our SSR example. Do you have a minimal reproduction repo for me to test out?

@brandongregoryscott brandongregoryscott added the question A question around API, functionality, etc. label Feb 21, 2023
@imsteev
Copy link
Author

imsteev commented Feb 22, 2023

@brandongregoryscott yeah I followed the concept of that example in a Remix app -- the code is here but you can see for yourself with these steps:

  1. visit https://drip.fly.dev
  2. notice how there's no spacing
  3. refresh
  4. styles are there

Did some more digging, and I think this problem is not specific to margins -- it's basically any dynamic value that can be provided (e.g, to a width prop)

@brandongregoryscott
Copy link
Contributor

it's basically any dynamic value that can be provided (e.g, to a width prop)

Yes, ui-box is the base for all of our Evergreen components and is responsible for managing the stylesheet as components are added to the DOM.

I haven't used Remix myself, but I'm guessing it's an issue with where that extractStyles is being called/rendered.

@brandongregoryscott brandongregoryscott changed the title How do margin props work? SSR with Remix Mar 6, 2023
@brandongregoryscott brandongregoryscott added the help-wanted An issue that needs additional investigation or community feedback to resolve label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted An issue that needs additional investigation or community feedback to resolve question A question around API, functionality, etc.
Projects
None yet
Development

No branches or pull requests

2 participants