Open SebastianGode opened 10 months ago
Hi @SebastianGode, we had a similar issue https://github.com/telekom/scale/issues/1773 a while back and I found this nextjs/stencil example there https://github.com/vercel/next.js/blob/canary/examples/with-stencil/packages/web-app/pages/_app.js .. It seems like they also suggest using useLayouEffect
although, as you say, there may be better performing solutions.
I found this https://css-tricks.com/using-web-components-with-next-or-any-ssr-framework/#aa-custom-bundling-web-component-code, and quickly tested it by replacing the contents of their shoelace-bundle.js
file with our defineCustomElements
- it seems to work, do you think this would be appropriate for your use case?
@SebastianGode were you able to test what Felix-ico suggested?
@amir-ba Yes, but sadly this is still rendering the actual CSS theme on the client-side. I found no way to prerender it.
Scale Version ^3.0.0-beta.139
Framework and version ^14.0.5-canary.43
Code Reproduction This will error out due to this issue: https://github.com/vercel/next.js/issues/54393
The code also can be found in the i18n branch here: https://github.com/opentelekomcloud-infra/circle-partner-navigator-frontend/blob/i18n/app/%5Blang%5D/layout.js Is there any way to prerender Scale without doing this on the Client-Side using React's useLayoutEffect Hook? This would also be faster as the client doesn't need to fetch the complete JS files form Scale first and just after that start rendering.