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

State of SSR? #4245

Closed
AxelBriche opened this issue May 8, 2023 · 13 comments
Closed

State of SSR? #4245

AxelBriche opened this issue May 8, 2023 · 13 comments

Comments

@AxelBriche
Copy link

Hello, is the "SSR" compatibility planned for 1.0 or even later?

There are now many fullstack frameworks like Next, Nuxt, Sveltekit, is a compatibility planned?

Currently using Material Web in one of these frameworks creates a delay of one second during which the components are not visible.

CleanShot 2023-05-08 at 15 43 18

@asyncLiz
Copy link
Collaborator

asyncLiz commented May 8, 2023

Not officially planned* for 1.0, but lit-ssr support may come out of the box :)

@e111077
Copy link
Contributor

e111077 commented Jun 21, 2023

Hello, update: he components should be SSRable via @lit-labs/ssr.

For NextJS integration see @lit-labs/nextjs:

https://www.npmjs.com/package/@lit-labs/nextjs

for React sans next see @lit-labs/ssr-react:

https://www.npmjs.com/package/@lit-labs/ssr-react

Nuxt lit implementation is in progress. I am going to close this issue because this component set complies with lit-ssr requirements. Future issues for integrations of lit-ssr should be filed on the Lit project over at https://github.com/lit/lit

@e111077 e111077 closed this as completed Jun 21, 2023
@e111077
Copy link
Contributor

e111077 commented Jun 21, 2023

@benjamincox
Copy link

@e111077 Why do the labels of both of these show up as some default Serif font in Chrome? Kind of looks like Times to me. Shouldn't these appear as Roboto or something? Selecting the button and inspecting, it seems there are no values for var(--_label-text-type).

image

@e111077
Copy link
Contributor

e111077 commented Jul 4, 2023

You need to load the actual Roboto font (or whatever font you change the label type to)

https://fonts.google.com/specimen/Roboto

@benjamincox
Copy link

@e111077 I don't seem to have edit privileges on your StackBlitz

@e111077
Copy link
Contributor

e111077 commented Jul 4, 2023

Heya I've updated the link with an external link import of Roboto. Please let me know if there are other issues

@benjamincox
Copy link

@e111077 Looks perfect now - thanks much!

@benjamincox
Copy link

@e111077 Hmmm... any idea why there is a FOUC effect? Is it somehow because the components load their CSS via Javascript?

@e111077
Copy link
Contributor

e111077 commented Jul 4, 2023

If you mean a fouc from the fonts it's likely because font has font-display swap. Personally I'd recommend hosting the font locally and setting swap to not block render as well as keep the FOUC time low since you don't have to open a new network connection

Edit: would also like to clarify. In SSR the styles are inlined into the template and not loaded via JS which should gzip incredibly well until declarative constructable stylesheets become a thing.

@JosefJezek
Copy link
Contributor

@e111077 please resolve an issue in Astro, see https://stackblitz.com/edit/github-uiraud?file=src%2Fpages%2Findex.astro

@JosefJezek
Copy link
Contributor

I created issue withastro/astro#8216

@e111077
Copy link
Contributor

e111077 commented Aug 24, 2023

Heya @JosefJezek. I'm sorry but we're really crunching right now to release Material web 1.0 and I currently do not have time to implement a fix for Astro. I've tried before but I couldn't find how they were managing hydration script injection timing without spending more time on it.

I have diagnosed the issue, and I hope the astro team or an open source contributor can chime in with a fix. Otherwise, I'll have to take a look after we successfully land Material web 1.0

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

No branches or pull requests

5 participants