Spaces:
Configuration error
Configuration error
zack
commited on
Commit
Β·
b694625
1
Parent(s):
6098905
fix(frontend/pages/index): π correct client-side rendering setup
Browse files- frontend/pages/index.js +15 -10
frontend/pages/index.js
CHANGED
@@ -1,16 +1,21 @@
|
|
1 |
-
import React from 'react';
|
2 |
import ReactDOM from 'react-dom/client';
|
3 |
import App from './_app';
|
4 |
import reportWebVitals from '../src/reportWebVitals';
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
// If you want to start measuring performance in your app, pass a function
|
14 |
-
// to log results (for example: reportWebVitals(console.log))
|
15 |
-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
16 |
reportWebVitals();
|
|
|
1 |
+
import React, { useEffect } from 'react';
|
2 |
import ReactDOM from 'react-dom/client';
|
3 |
import App from './_app';
|
4 |
import reportWebVitals from '../src/reportWebVitals';
|
5 |
|
6 |
+
// Function to render the app only on the client-side
|
7 |
+
const renderApp = () => {
|
8 |
+
const root = ReactDOM.createRoot(document.getElementById('Gradio-Flow'));
|
9 |
+
root.render(
|
10 |
+
<React.StrictMode>
|
11 |
+
<App/>
|
12 |
+
</React.StrictMode>
|
13 |
+
);
|
14 |
+
};
|
15 |
+
|
16 |
+
if (typeof window !== 'undefined') {
|
17 |
+
// Ensure this code runs only in the browser
|
18 |
+
renderApp();
|
19 |
+
}
|
20 |
|
|
|
|
|
|
|
21 |
reportWebVitals();
|