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

Concern about unstable_read and SSR #2544

Closed
johntran opened this issue Oct 7, 2018 · 3 comments
Closed

Concern about unstable_read and SSR #2544

johntran opened this issue Oct 7, 2018 · 3 comments

Comments

@johntran
Copy link

johntran commented Oct 7, 2018

Hi there,

@TrySound brought up a good point in this comment about how SSR wouldn't work for components where unstable_read is being used.

It seems to be best to revert the change back to use <ReactRelayContext.Consumer> and use unstable_read in the relay-experimental package.

@TrySound provided a codesandbox repo to show how unstable_read breaks SSR: https://codesandbox.io/s/l5j35928xl

Thoughts?

@josephsavona
Copy link
Contributor

cc @jstejada

jstejada referenced this issue Oct 17, 2018
Reviewed By: jstejada

Differential Revision: D9972097

fbshipit-source-id: a04c576fa93085e172373ee3ca8ed35be8299fc3
@jstejada
Copy link
Contributor

Thanks for bringing this up @johntran, @TrySound. React is actually going to remove unstable_read, so we will end updating this in a way that is also SSR compatible

@TrySound
Copy link
Contributor

Well, it's not quite removed. It's hidden in react internals. Libraries still can use it for own purpose. For example in relay it would be nice to have an api without render props and HOCs like this

const fragment = createFragment(
  graphql``
)

const Component = props => {
  const user = fragment.read(props.user)
  return null
}

TrySound referenced this issue Jan 26, 2019
Reviewed By: alunyov

Differential Revision: D13827853

fbshipit-source-id: 5fd3808aefcd5686a1c4d160ea5d23f9b022c07e
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

4 participants