You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.
I sent this in a tweet to @divmain but thought it was worth expanding on here.
The first version of react-dom-stream took the same checksum strategy you are using here in Rapscallion: have the checksum be an extra attribute on the stream which the API client can then read out into a script tag, and that script tag in turn sets the checksum on the react root. This strategy works, but it caused a lot of confusion with users; if my experience is any indication, you may end up spending a lot of time explaining and supporting this quirk in github issues/gitter.
I wanted to just render out the script tag that was needed at the end of the stream, but React complains when it renders into an element where there are siblings that weren't made by React. I realized later, though, that you could read out such a script tag at the end of the stream and have it set the checksum and then delete itself from the DOM before React client rendering happens. I tested this in all my supported browsers, and it worked. Its implementation is here, and you should feel free to use any part of it that is helpful in Rapscallion.
Cheers!
The text was updated successfully, but these errors were encountered:
Thanks for expanding on this here! One thought is that this could be optional and explicit, by passing an option to the toStream method. Something like renderer.toStream({ autoInsertChecksum: true }).pipe(res);
I sent this in a tweet to @divmain but thought it was worth expanding on here.
The first version of
react-dom-stream
took the same checksum strategy you are using here in Rapscallion: have the checksum be an extra attribute on the stream which the API client can then read out into a script tag, and that script tag in turn sets the checksum on the react root. This strategy works, but it caused a lot of confusion with users; if my experience is any indication, you may end up spending a lot of time explaining and supporting this quirk in github issues/gitter.I wanted to just render out the script tag that was needed at the end of the stream, but React complains when it renders into an element where there are siblings that weren't made by React. I realized later, though, that you could read out such a script tag at the end of the stream and have it set the checksum and then delete itself from the DOM before React client rendering happens. I tested this in all my supported browsers, and it worked. Its implementation is here, and you should feel free to use any part of it that is helpful in Rapscallion.
Cheers!
The text was updated successfully, but these errors were encountered: