GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — [Flight] Refactor the Render Loop to Behave More Like Fizz by sebmarkbage · Pull Request #28065 · react/react Conversation
Contributor
This refactors the Flight render loop to behave more like Fizz with similar naming conventions. So it's easier to apply similar techniques across both. This is not necessarily better/faster - at least not yet. This doesn't yet implement serialization by writing segments to chunks but we probably should do that since the built-in parts that Right now it's not technically fully recursive because each recursive render returns the next JSON value to encode. So it's kind of like a trampoline. This means we can't have many contextual things on the stack. It needs to use the Server Context An interesting observation here is that Similarly to how Suspense boundaries in Fizz can catch errors, anything that can be reduced to Lazy can also catch an error rather than bubbling it. It only errors when the Lazy resolves. Unlike Suspense boundaries though, those things don't render anything so they're otherwise going to use the destructive form. To ensure that throwing in an Element can reuse the current task, this must be handled by
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Start unifying naming with Fizz. They use a slightly different code structure so it won't use the same recursion yet at least. Unlike Fizz, the split between renderModel/renderModelDestructive isn't used because we don't bother catching suspense from anything but Lazy which is already handling this separately. In Fizz only Suspense boundaries can catch errors but in Flight any Element can catch errors because it can be replaced by a Lazy. This will render into a JSON value but will not be recursively resolved. If it's a terminal JSON value shouldn't double encode it. Otherwise resuspending can't be handled by retryTask. Test that a sequence of server components is able to reuse the row That way this only happens in the non-terminal branches instead of being called on the terminal branches too. This doesn't come into play in Flight because the provider is not destructive so you can't suspend in the current task within a new context. The feature is also deprecated anyway. This is just for parity. All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
sebmarkbage
commented
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Notably this doesn't tag things that are returned from a Server Component at this ID as having the same ID as the Element itself. So it might outline the return value again instead of reusing the same ID. However, I'm not sure Server Components will be reusable with some other changes coming anyway.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
gnoff
approved these changes
github-actions Bot
pushed a commit
that referenced
this pull request
This refactors the Flight render loop to behave more like Fizz with similar naming conventions. So it's easier to apply similar techniques across both. This is not necessarily better/faster - at least not yet. This doesn't yet implement serialization by writing segments to chunks but we probably should do that since the built-in parts that `JSON.stringify` gets us isn't really much anymore (except serializing strings). When we switch to that it probably makes sense for the whole thing to be recursive. Right now it's not technically fully recursive because each recursive render returns the next JSON value to encode. So it's kind of like a trampoline. This means we can't have many contextual things on the stack. It needs to use the Server Context `__POP` trick. However, it does work for things that are contextual only for one sequence of server component abstractions in a row. Since those are now recursive. An interesting observation here is that `renderModel` means that anything can suspend while still serializing the outer siblings. Typically only Lazy or Components would suspend but in principle a Proxy can suspend/postpone too and now that is left serialized by reference to a future value. It's only if the thing that we rendered was something that can reduce to Lazy e.g. an Element that we can serialize it as a lazy. Similarly to how Suspense boundaries in Fizz can catch errors, anything that can be reduced to Lazy can also catch an error rather than bubbling it. It only errors when the Lazy resolves. Unlike Suspense boundaries though, those things don't render anything so they're otherwise going to use the destructive form. To ensure that throwing in an Element can reuse the current task, this must be handled by `renderModel`, not for example `renderElement`. DiffTrain build for [b123b9c](b123b9c)
gnoff
added a commit
to gnoff/next.js
that referenced
this pull request
- react/react#28250 - react/react#28225 - react/react#28123 - react/react#28240 - react/react#28239 - react/react#28245 - react/react#28244 - react/react#28238 - react/react#28235 - react/react#28221 - react/react#28215 - react/react#28214 - react/react#28213 - react/react#28212 - react/react#28211 - react/react#28247 - react/react#28210 - react/react#28186 - react/react#28232 - react/react#28169 - react/react#28177 - react/react#28170 - react/react#28168 - react/react#28122 - react/react#27982 - react/react#28217 - react/react#28223 - react/react#28208 - react/react#28209 - react/react#28200 - react/react#28199 - react/react#28198 - react/react#28197 - react/react#28196 - react/react#28194 - react/react#28192 - react/react#28191 - react/react#28182 - react/react#28181 - react/react#28180 - react/react#28178 - react/react#28201 - react/react#28176 - react/react#28162 - react/react#28131 - react/react#28190 - react/react#28172 - react/react#28171 - react/react#28173 - react/react#28174 - react/react#28175 - react/react#28136 - react/react#28135 - react/react#28134 - react/react#28133 - react/react#28132 - react/react#28130 - react/react#28202 - react/react#28102 - react/react#28161 - react/react#28193 - react/react#28195 - react/react#28189 - react/react#28160 - react/react#28096 - react/react#28183 - react/react#28125 - react/react#28157 - react/react#28115 - react/react#28124 - react/react#28163 - react/react#28164 - react/react#28150 - react/react#28159 - react/react#28069 - react/react#28110 - react/react#28148 - react/react#28116 - react/react#28099 - react/react#28100 - react/react#28147 - react/react#28128 - react/react#28126 - react/react#28139 - react/react#28140 - react/react#28141 - react/react#28142 - react/react#28113 - react/react#28129 - react/react#28114 - react/react#28053 - react/react#28091 - react/react#28087 - react/react#28112 - react/react#28086 - react/react#28101 - react/react#28106 - react/react#28117 - react/react#28118 - react/react#28105 - react/react#27883 - react/react#28111 - react/react#28095 - react/react#28108 - react/react#28090 - react/react#28089 - react/react#28076 - react/react#28074 - react/react#28103 - react/react#28098 - react/react#28097 - react/react#28068 - react/react#28093 - react/react#28094 - react/react#28073 - react/react#28084 - react/react#28063 - react/react#28085 - react/react#28083 - react/react#28065 - react/react#28061 - react/react#28077 - react/react#28075 - react/react#28078 - react/react#28050 - react/react#28011 - react/react#28055 - react/react#28066 - react/react#28067 - react/react#28010 - react/react#27993 - react/react#28052 - react/react#28060 - react/react#28059 - react/react#28034 - react/react#28033 - react/react#28004 - react/react#28051 - react/react#28012 - react/react#28001 - react/react#28002 - react/react#27995 - react/react#28006 - react/react#28005 - react/react#28007 - react/react#28008 - react/react#28009 - react/react#28000 - react/react#28003 - react/react#27997 - react/react#27240 - react/react#27977 - react/react#27940 - react/react#27939 - react/react#28090 - react/react#28089 - react/react#28076 - react/react#28074 - react/react#28103 - react/react#28098 - react/react#28097 - react/react#28068 - react/react#28093 - react/react#28094 - react/react#28073 - react/react#28084 - react/react#28063 - react/react#28085 - react/react#28083 - react/react#28065 - react/react#28061 - react/react#28077 - react/react#28075 - react/react#28078 - react/react#28050 - react/react#28011 - react/react#28055 - react/react#28066 - react/react#28067 - react/react#28010 - react/react#27993 - react/react#28052 - react/react#28060 - react/react#28059 - react/react#28034 - react/react#28033 - react/react#28004 - react/react#28051 - react/react#28012 - react/react#28001 - react/react#28002 - react/react#27995 - react/react#28006 - react/react#28005 - react/react#28007 - react/react#28008 - react/react#28009 - react/react#28000 - react/react#28003 - react/react#27997 - react/react#27240 - react/react#27977 - react/react#27940 - react/react#27939
gnoff
added a commit
to vercel/next.js
that referenced
this pull request
Updates React from 60a927d04 to 2bc7d336a Also updates aliases for `react.shared-subset` to `react.react-server` ### React upstream changes - react/react#28250 - react/react#28225 - react/react#28123 - react/react#28240 - react/react#28239 - react/react#28245 - react/react#28244 - react/react#28238 - react/react#28235 - react/react#28221 - react/react#28215 - react/react#28214 - react/react#28213 - react/react#28212 - react/react#28211 - react/react#28247 - react/react#28210 - react/react#28186 - react/react#28232 - react/react#28169 - react/react#28177 - react/react#28170 - react/react#28168 - react/react#28122 - react/react#27982 - react/react#28217 - react/react#28223 - react/react#28208 - react/react#28209 - react/react#28200 - react/react#28199 - react/react#28198 - react/react#28197 - react/react#28196 - react/react#28194 - react/react#28192 - react/react#28191 - react/react#28182 - react/react#28181 - react/react#28180 - react/react#28178 - react/react#28201 - react/react#28176 - react/react#28162 - react/react#28131 - react/react#28190 - react/react#28172 - react/react#28171 - react/react#28173 - react/react#28174 - react/react#28175 - react/react#28136 - react/react#28135 - react/react#28134 - react/react#28133 - react/react#28132 - react/react#28130 - react/react#28202 - react/react#28102 - react/react#28161 - react/react#28193 - react/react#28195 - react/react#28189 - react/react#28160 - react/react#28096 - react/react#28183 - react/react#28125 - react/react#28157 - react/react#28115 - react/react#28124 - react/react#28163 - react/react#28164 - react/react#28150 - react/react#28159 - react/react#28069 - react/react#28110 - react/react#28148 - react/react#28116 - react/react#28099 - react/react#28100 - react/react#28147 - react/react#28128 - react/react#28126 - react/react#28139 - react/react#28140 - react/react#28141 - react/react#28142 - react/react#28113 - react/react#28129 - react/react#28114 - react/react#28053 - react/react#28091 - react/react#28087 - react/react#28112 - react/react#28086 - react/react#28101 - react/react#28106 - react/react#28117 - react/react#28118 - react/react#28105 - react/react#27883 - react/react#28111 - react/react#28095 - react/react#28108 - react/react#28090 - react/react#28089 - react/react#28076 - react/react#28074 - react/react#28103 - react/react#28098 - react/react#28097 - react/react#28068 - react/react#28093 - react/react#28094 - react/react#28073 - react/react#28084 - react/react#28063 - react/react#28085 - react/react#28083 - react/react#28065 - react/react#28061 - react/react#28077 - react/react#28075 - react/react#28078 - react/react#28050 - react/react#28011 - react/react#28055 - react/react#28066 - react/react#28067 - react/react#28010 - react/react#27993 - react/react#28052 - react/react#28060 - react/react#28059 - react/react#28034 - react/react#28033 - react/react#28004 - react/react#28051 - react/react#28012 - react/react#28001 - react/react#28002 - react/react#27995 - react/react#28006 - react/react#28005 - react/react#28007 - react/react#28008 - react/react#28009 - react/react#28000 - react/react#28003 - react/react#27997 - react/react#27240 - react/react#27977 - react/react#27940 - react/react#27939 - react/react#28090 - react/react#28089 - react/react#28076 - react/react#28074 - react/react#28103 - react/react#28098 - react/react#28097 - react/react#28068 - react/react#28093 - react/react#28094 - react/react#28073 - react/react#28084 - react/react#28063 - react/react#28085 - react/react#28083 - react/react#28065 - react/react#28061 - react/react#28077 - react/react#28075 - react/react#28078 - react/react#28050 - react/react#28011 - react/react#28055 - react/react#28066 - react/react#28067 - react/react#28010 - react/react#27993 - react/react#28052 - react/react#28060 - react/react#28059 - react/react#28034 - react/react#28033 - react/react#28004 - react/react#28051 - react/react#28012 - react/react#28001 - react/react#28002 - react/react#27995 - react/react#28006 - react/react#28005 - react/react#28007 - react/react#28008 - react/react#28009 - react/react#28000 - react/react#28003 - react/react#27997 - react/react#27240 - react/react#27977 - react/react#27940 - react/react#27939 Closes NEXT-2331
EdisonVan
pushed a commit
to EdisonVan/react
that referenced
this pull request
This refactors the Flight render loop to behave more like Fizz with similar naming conventions. So it's easier to apply similar techniques across both. This is not necessarily better/faster - at least not yet. This doesn't yet implement serialization by writing segments to chunks but we probably should do that since the built-in parts that `JSON.stringify` gets us isn't really much anymore (except serializing strings). When we switch to that it probably makes sense for the whole thing to be recursive. Right now it's not technically fully recursive because each recursive render returns the next JSON value to encode. So it's kind of like a trampoline. This means we can't have many contextual things on the stack. It needs to use the Server Context `__POP` trick. However, it does work for things that are contextual only for one sequence of server component abstractions in a row. Since those are now recursive. An interesting observation here is that `renderModel` means that anything can suspend while still serializing the outer siblings. Typically only Lazy or Components would suspend but in principle a Proxy can suspend/postpone too and now that is left serialized by reference to a future value. It's only if the thing that we rendered was something that can reduce to Lazy e.g. an Element that we can serialize it as a lazy. Similarly to how Suspense boundaries in Fizz can catch errors, anything that can be reduced to Lazy can also catch an error rather than bubbling it. It only errors when the Lazy resolves. Unlike Suspense boundaries though, those things don't render anything so they're otherwise going to use the destructive form. To ensure that throwing in an Element can reuse the current task, this must be handled by `renderModel`, not for example `renderElement`.
bigfootjon
pushed a commit
that referenced
this pull request
This refactors the Flight render loop to behave more like Fizz with similar naming conventions. So it's easier to apply similar techniques across both. This is not necessarily better/faster - at least not yet. This doesn't yet implement serialization by writing segments to chunks but we probably should do that since the built-in parts that `JSON.stringify` gets us isn't really much anymore (except serializing strings). When we switch to that it probably makes sense for the whole thing to be recursive. Right now it's not technically fully recursive because each recursive render returns the next JSON value to encode. So it's kind of like a trampoline. This means we can't have many contextual things on the stack. It needs to use the Server Context `__POP` trick. However, it does work for things that are contextual only for one sequence of server component abstractions in a row. Since those are now recursive. An interesting observation here is that `renderModel` means that anything can suspend while still serializing the outer siblings. Typically only Lazy or Components would suspend but in principle a Proxy can suspend/postpone too and now that is left serialized by reference to a future value. It's only if the thing that we rendered was something that can reduce to Lazy e.g. an Element that we can serialize it as a lazy. Similarly to how Suspense boundaries in Fizz can catch errors, anything that can be reduced to Lazy can also catch an error rather than bubbling it. It only errors when the Lazy resolves. Unlike Suspense boundaries though, those things don't render anything so they're otherwise going to use the destructive form. To ensure that throwing in an Element can reuse the current task, this must be handled by `renderModel`, not for example `renderElement`. DiffTrain build for commit b123b9c.
hanzo-dev
pushed a commit
to hanzoai/react
that referenced
this pull request
This refactors the Flight render loop to behave more like Fizz with similar naming conventions. So it's easier to apply similar techniques across both. This is not necessarily better/faster - at least not yet. This doesn't yet implement serialization by writing segments to chunks but we probably should do that since the built-in parts that `JSON.stringify` gets us isn't really much anymore (except serializing strings). When we switch to that it probably makes sense for the whole thing to be recursive. Right now it's not technically fully recursive because each recursive render returns the next JSON value to encode. So it's kind of like a trampoline. This means we can't have many contextual things on the stack. It needs to use the Server Context `__POP` trick. However, it does work for things that are contextual only for one sequence of server component abstractions in a row. Since those are now recursive. An interesting observation here is that `renderModel` means that anything can suspend while still serializing the outer siblings. Typically only Lazy or Components would suspend but in principle a Proxy can suspend/postpone too and now that is left serialized by reference to a future value. It's only if the thing that we rendered was something that can reduce to Lazy e.g. an Element that we can serialize it as a lazy. Similarly to how Suspense boundaries in Fizz can catch errors, anything that can be reduced to Lazy can also catch an error rather than bubbling it. It only errors when the Lazy resolves. Unlike Suspense boundaries though, those things don't render anything so they're otherwise going to use the destructive form. To ensure that throwing in an Element can reuse the current task, this must be handled by `renderModel`, not for example `renderElement`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |