Skip to content

Commit 44d3758

Browse files
rename __FLIGHT_DATA to REACT_ON_RAILS_RSC_PAYLOAD for improved clarity and consistency in RSC streaming handling.
1 parent 6765eae commit 44d3758

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

node_package/src/RSCClientRoot.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (typeof use !== 'function') {
1717

1818
declare global {
1919
interface Window {
20-
__FLIGHT_DATA: unknown[];
20+
REACT_ON_RAILS_RSC_PAYLOAD: unknown[];
2121
}
2222
}
2323

@@ -53,11 +53,11 @@ const createRSCStreamFromPage = () => {
5353
const handleChunk = (chunk: unknown) => {
5454
controller.enqueue(chunk as RSCPayloadChunk);
5555
};
56-
if (!window.__FLIGHT_DATA) {
57-
window.__FLIGHT_DATA = [];
56+
if (!window.REACT_ON_RAILS_RSC_PAYLOAD) {
57+
window.REACT_ON_RAILS_RSC_PAYLOAD = [];
5858
}
59-
window.__FLIGHT_DATA.forEach(handleChunk);
60-
window.__FLIGHT_DATA.push = (...chunks: unknown[]) => {
59+
window.REACT_ON_RAILS_RSC_PAYLOAD.forEach(handleChunk);
60+
window.REACT_ON_RAILS_RSC_PAYLOAD.push = (...chunks: unknown[]) => {
6161
chunks.forEach(handleChunk);
6262
return chunks.length;
6363
};

node_package/src/RSCPayloadContainer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const RSCPayloadContainer = ({
2727

2828
const scriptElement = React.createElement('script', {
2929
dangerouslySetInnerHTML: {
30-
__html: escapeScript(`(self.__FLIGHT_DATA||=[]).push(${chunk.chunk})`),
30+
__html: escapeScript(`(self.REACT_ON_RAILS_RSC_PAYLOAD||=[]).push(${chunk.chunk})`),
3131
},
3232
key: `script-${chunkIndex}`,
3333
});

0 commit comments

Comments
 (0)