Skip to content

Commit 9bf48f4

Browse files
committed
Move first load component to the bottom
1 parent 7ff7427 commit 9bf48f4

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/js/src/index.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,29 +56,6 @@ export function History({ onHistoryChangeCallback }) {
5656
return null;
5757
}
5858

59-
/**
60-
* FirstLoad component that captures the URL during the initial page load and notifies the server.
61-
*
62-
* @param {Object} props - The properties object.
63-
* @param {Function} props.onFirstLoadCallback - Callback function to notify the server about the first load.
64-
* @returns {null} This component does not render any visible output.
65-
* @description
66-
* This component sends the current URL to the server during the initial page load.
67-
* @see https://github.com/reactive-python/reactpy/pull/1224
68-
*/
69-
export function FirstLoad({ onFirstLoadCallback }) {
70-
// FIXME: This component only exists because of a ReactPy core rendering bug, and should be removed when the bug
71-
// is fixed. Ideally all this logic would be handled by the `History` component.
72-
React.useEffect(() => {
73-
onFirstLoadCallback({
74-
pathname: window.location.pathname,
75-
search: window.location.search,
76-
});
77-
return () => {};
78-
}, []);
79-
return null;
80-
}
81-
8259
/**
8360
* Link component that captures clicks on anchor links and notifies the server.
8461
*
@@ -148,3 +125,26 @@ export function Navigate({ onNavigateCallback, to, replace }) {
148125

149126
return null;
150127
}
128+
129+
/**
130+
* FirstLoad component that captures the URL during the initial page load and notifies the server.
131+
*
132+
* @param {Object} props - The properties object.
133+
* @param {Function} props.onFirstLoadCallback - Callback function to notify the server about the first load.
134+
* @returns {null} This component does not render any visible output.
135+
* @description
136+
* This component sends the current URL to the server during the initial page load.
137+
* @see https://github.com/reactive-python/reactpy/pull/1224
138+
*/
139+
export function FirstLoad({ onFirstLoadCallback }) {
140+
// FIXME: This component only exists because of a ReactPy core rendering bug, and should be removed when the bug
141+
// is fixed. Ideally all this logic would be handled by the `History` component.
142+
React.useEffect(() => {
143+
onFirstLoadCallback({
144+
pathname: window.location.pathname,
145+
search: window.location.search,
146+
});
147+
return () => {};
148+
}, []);
149+
return null;
150+
}

0 commit comments

Comments
 (0)