Given Emotion's Global
component is used in a component that is lazy loaded and wrapped in Suspense
, and the parent component is rendered upon initial page load, the global styles are not removed when that component is unmounted
#3038
Labels
Current behavior:
Given Emotion's
Global
component is used in a component that is lazy loaded and wrapped inSuspense
, and the parent component is rendered upon initial page load, the global styles are not removed when that component is unmounted.Note that when
Global
is not in a component that is rendered on initial page load (while wrapped inSuspense
), global styles are correctly removed when the parent component is unmounted.Seps to reproduce:
Failing Test Case
Using this example: https://stackblitz.com/edit/react-ts-agivwh?file=App.tsx
Page1
componentPassing Test Case
Using the same example at https://stackblitz.com/edit/react-ts-agivwh
App.tsx
, set the initial value ofcurrentPage
to the value of/page2
, then reload web viewPage2
componentGlobal body style was correctly added and removed.
I tested this in an example without using suspense and everything works as expected following the same steps above
https://stackblitz.com/edit/react-ts-xwa9w5?file=App.tsx
The text was updated successfully, but these errors were encountered: