react-freeze icon indicating copy to clipboard operation
react-freeze copied to clipboard

Remove Suspense when freeze false

Open xotahal opened this issue 3 years ago • 1 comments

More of a question than an issue I would say. Why do we need Suspense here https://github.com/software-mansion/react-freeze/blob/main/src/index.tsx#L39?

The react-freeze is used by react-navigation. I don't use the freeze option but my screens go to suspense in this library and render null. I believe there would be a way to propagate placeholder and display something, but I already have suspense in my app. I want that suspense to catch the promise.

I can submit a PR with something like this:

if (!freeze) {
  return <Fragment>{props.children}</Fragment>
}

I just wanted to validate first

xotahal avatar Dec 06 '22 05:12 xotahal

Found this comment - https://github.com/software-mansion/react-native-screens/pull/1538#issuecomment-1212001180. Which I guess answers my question.

Anyway, I experience issues caused by this suspense. When I render a simple navigator with react-navigation:

<NavigatorContainer>
  <Stack.Navigator>
    <Stack.Screen component={Authorized} />
  </Stack.Navigator>
</NavigatorContainer>

And the Authorized goes to Suspense it will never get rendered on screen when using version of react-native-screens with react-freeze (if I use console.logs in the Authorized component it prints them). As soon as I switch to [email protected] everything works. (react-freeze was added in 3.9.0).

xotahal avatar Dec 06 '22 06:12 xotahal