dark
dark copied to clipboard
[data] Make dehydration of DataClient manual
I am using a Page
component that has an App
child component.
On the server:
- a
DataClient
is created and given to theApp
component - The
App
component is rendered - The
DataClient
is then given to thePage
component. This allows thePage
component to use the data needed to renderApp
, without duplicating logic and without performing the same requests twice. - The Page component is rendered and used as response.
This results in 2 <script type="text/dark-state">
elements being generated in the server response to the browser.
To prevent this, I propose the DataClient should be dehydrated manually.