diff --git a/visions/ui/src/App.test.tsx b/visions/ui/src/App.test.tsx
index 2a68616..7c359e5 100644
--- a/visions/ui/src/App.test.tsx
+++ b/visions/ui/src/App.test.tsx
@@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
- render();
+ // render();
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
diff --git a/visions/ui/src/App.tsx b/visions/ui/src/App.tsx
index b0045e9..b2a38b5 100644
--- a/visions/ui/src/App.tsx
+++ b/visions/ui/src/App.tsx
@@ -6,13 +6,16 @@ import { Client } from './client';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import { GmPlayingFieldComponent } from './components/GmPlayingField/GmPlayingField';
-const App = () => {
+interface AppProps {
+ client: Client;
+}
+
+const App = ({ client }: AppProps) => {
console.log("rendering app");
- const client = new Client();
const [websocketUrl, setWebsocketUrl] = useState(undefined);
useEffect(() => {
- client.registerWebsocket().then((url) => setWebsocketUrl(url));
+ client.registerWebsocket().then((url) => setWebsocketUrl(url))
}, [client]);
let router =
diff --git a/visions/ui/src/index.tsx b/visions/ui/src/index.tsx
index 032464f..ecf2259 100644
--- a/visions/ui/src/index.tsx
+++ b/visions/ui/src/index.tsx
@@ -3,13 +3,16 @@ import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
+import { Client } from './client';
+
+const client = new Client();
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
-
+
);