dillon1000/react
Commit
Browse files [Flight] Encode Symbols as special rows that can be referenced by models … (#20171)
* Encode Symbols as special rows that can be referenced by models
If a symbol was extracted from Symbol.for(...) then we can reliably
recreate the same symbol on the client.
S123:"react.suspense"
M456:{mySymbol: '$123'}
This doesn't suffer from the XSS problem because you have to write actual
code to create one of these symbols. That problem is only a problem because
values pass through common other usages of JSON which are not secure.
Since React encodes its built-ins as symbols, we can now use them as long
as its props are serializable. Like Suspense.
* Refactor resolution to avoid memo hack
Going through createElement isn't quite equivalent for ref and key in props.
* Reuse symbol ids that have already been written earlier in the streamChanged paths14 files
First-parent comparisonpackages/react-client/src/ReactFlightClient.js ModifiedM packages/react-client/src/ReactFlightClientStream.js ModifiedM packages/react-client/src/__tests__/ReactFlight-test.js ModifiedM packages/react-server/src/ReactFlightServer.js ModifiedM packages/react-server/src/ReactFlightServerConfigStream.js ModifiedM packages/react-transport-dom-relay/src/ReactFlightDOMRelayClient.js ModifiedM packages/react-transport-dom-relay/src/ReactFlightDOMRelayProtocol.js ModifiedM packages/react-transport-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js ModifiedM packages/react-transport-dom-relay/src/__tests__/ReactFlightDOMRelay-test.internal.js ModifiedM packages/react-transport-dom-webpack/src/__tests__/ReactFlightDOM-test.js ModifiedM packages/react-transport-native-relay/src/ReactFlightNativeRelayClient.js ModifiedM packages/react-transport-native-relay/src/ReactFlightNativeRelayProtocol.js ModifiedM packages/react-transport-native-relay/src/ReactFlightNativeRelayServerHostConfig.js ModifiedM scripts/error-codes/codes.json ModifiedPatch
Files changed
Rendering syntax-highlighted changes…