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

[WIP] Initial support for React fiber. #2659

Closed
wants to merge 1 commit into from

Conversation

arunoda
Copy link
Contributor

@arunoda arunoda commented Jul 27, 2017

Fixes #1098

We are not going to merge this soon unless React 16 ships before 3.0 release.
Otherwise, we need to look at a way to detect React 16 and support React patching if that's React 15.

@timneutkens
Copy link
Member

Cool!

@arunoda arunoda changed the title Initial support for React fiber. [WIP] Initial support for React fiber. Jul 27, 2017
@stipsan
Copy link
Contributor

stipsan commented Jul 30, 2017

Any chance this can be released on its own tag?

For now I've forked your branch and published it here to allow using React Fiber on a Next.js app I'm working on that uses the new react-dom/node-stream api.
I prefer not to fork and publish on npm as it's a bit noisy. When a fork is no longer needed you can't "unpublish" it from npm 😞

@arunoda
Copy link
Contributor Author

arunoda commented Jul 31, 2017

@stipsan that's something we can do just after we release 3.0.
Using node-stream will be challenging as we need to update next/head and styled-jsx accordingly.

@stipsan
Copy link
Contributor

stipsan commented Aug 1, 2017

Alright.
It is indeed challenging if the goal is to replace the SSR that next.js is doing for free with streaming. I'm not even sure if doing something like that makes sense. My use case is to stream a component directly to svg using my own route handler.
I don't have a lot of data yet on how using node-stream rendering performs in the real world yet, but my impression that it's primary use case is to keep memory usage low (by sending the string in chunks instead of the full string in one big push) turns out to be true. So far I've seen that it has slower total loadtime than using ReactDOMServer.

For my use case though it's a good tradeoff as I want to use in-memory cache for base64 encoded avatar uris (SVGs that are rendered in an <img> tag do not support loading remote files, only base64 uris).
Because of the base64 uri strings the resulting svg strings can be pretty huge, easily over 1MB. node-stream increases the amount of SVGs that can be rendered before hitting the RAM limit of the node 😄

I don't think it makes sense to use node-stream in use cases where you're not pushing a lot of data to the client. Which is most use cases, right?

@arunoda
Copy link
Contributor Author

arunoda commented Aug 2, 2017

I don't think it makes sense to use node-stream in use cases where you're not pushing a lot of data to the client. Which is most use cases, right?

That's what we think right now. Streams doesn't add much in performance wise for Next.js.
But end of the day, this is something we need to consider.

@arunoda arunoda mentioned this pull request Aug 2, 2017
@frol
Copy link
Contributor

frol commented Aug 2, 2017

@stipsan @arunoda You are talking about streaming VS full-render performance from the unit of work perspective, but if you consider the performance from the user perspective you will notice that streaming can outperform full-render significantly due to the lower time to first byte (TTFB): https://www.youtube.com/watch?v=UhdGiVy3_Nk

@stipsan
Copy link
Contributor

stipsan commented Aug 8, 2017

@frol thanks for sharing that video. It appears streams is the next performance frontier 😄

@msand
Copy link

msand commented Aug 27, 2017

@arunoda @rauchg Would it be possible to get this under a v3.1.0 beta, fiber or some similar tag?

@timneutkens timneutkens changed the base branch from v3-beta to master August 27, 2017 20:16
@msand
Copy link

msand commented Sep 2, 2017

@arunoda @timneutkens
Is this supposed to work / be possible to use as a dependency already?
If I install arunodas fork commit hash using npm / yarn then I'm unable to start next.
If I install the latest version of next normally, and apply this or my own patch manually then it works fine.

@rawrmaan
Copy link

rawrmaan commented Sep 8, 2017

Fiber is now in RC and I'm having to maintain two branches (one with next and react 15, one with next disabled and react 16). Would be great to get a timeline in this, and I'd be happy to help in any way I can!

@Faradey27
Copy link

@arunoda react 16 is released, do you plan to merge?

@timneutkens timneutkens mentioned this pull request Sep 26, 2017
@kjs3
Copy link
Contributor

kjs3 commented Sep 26, 2017

Continuing this work here: #2996

@timneutkens
Copy link
Member

Tracking it here #2996

@arunoda arunoda deleted the react-fiber-support branch September 28, 2017 16:28
@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants