polaris icon indicating copy to clipboard operation
polaris copied to clipboard

Getting useLayoutEffect errors in SSR in Remix with the Remix Shopify App Template

Open muchisx opened this issue 10 months ago • 5 comments

https://github.com/Shopify/polaris/blob/a89e61478fb7c5f588021e542101aba8a3898ec8/polaris-react/src/components/IndexTable/IndexTable.tsx#L7-L8

I checked the line here 👆🏻, Maybe better to go back to use useIsomorphicLayoutEffect being required everywhere ?

image

muchisx avatar Apr 09 '24 05:04 muchisx

Same problem here updated to last version using IndexTable with Remix.

"@shopify/polaris": "^13.0.0",

Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes. 09:50:55 │ remix │ at IndexTableBase

oliversd avatar Apr 09 '24 13:04 oliversd

cc @jesstelford it looks like it might have been you that changed from useIsomorphicLayoutEffect to useLayoutEffect here. Do you have a bit of time to investigate?

kyledurand avatar Apr 09 '24 15:04 kyledurand

Any update on this ?

saifulapm avatar Apr 13 '24 16:04 saifulapm

Thanks for the report folks, the error messages & prior investigation made it much easier to track down!

jesstelford avatar Apr 26 '24 05:04 jesstelford

I've got a fix open in #11950 👍

jesstelford avatar Apr 26 '24 05:04 jesstelford

The fix will be shipped in the following release: https://github.com/Shopify/polaris/pull/11997

jesstelford avatar May 13 '24 06:05 jesstelford