diff --git a/lexicon/package.json b/lexicon/package.json index f699ee44f8..599de26d01 100644 --- a/lexicon/package.json +++ b/lexicon/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@urbit/http-api": "^2.3.0", - "react-router-dom": "^6.4.3", + "react-router-dom": "^6.14.1", "zustand": "^4.3.8" }, "peerDependencies": { @@ -31,4 +31,4 @@ "babel-loader": "^8.3.0", "babel-plugin-styled-components": "^2.0.7" } -} \ No newline at end of file +} diff --git a/lexicon/src/Lexicon.tsx b/lexicon/src/Lexicon.tsx index 2973b5482e..55e0f5f8aa 100644 --- a/lexicon/src/Lexicon.tsx +++ b/lexicon/src/Lexicon.tsx @@ -1,5 +1,5 @@ import { useEffect } from 'react'; -import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; +import { BrowserRouter, redirect, Route, Routes } from 'react-router-dom'; import { createGlobalStyle } from 'styled-components'; import { @@ -28,6 +28,7 @@ const GlobalStyle = createGlobalStyle` outline: none; } `; + declare global { interface Window { ship: string; @@ -296,37 +297,39 @@ export const Lexicon = ({ useEffect(() => { setShipName(shipName); }, [shipName]); + + useEffect(() => { + // Start at the root path. + redirect('/'); + }, []); + if (!api) return null; + return ( - <> -
- - - - }> - } - /> - } /> - } - /> - don't mind me just redirecting over here

} - /> -
-
-
-
- +
+ + + + }> + } + /> + } /> + } /> + don't mind me just redirecting over here

} + /> +
+
+
+
); }; diff --git a/trove/package.json b/trove/package.json index 640924ef99..6f61396743 100644 --- a/trove/package.json +++ b/trove/package.json @@ -26,7 +26,7 @@ "mime": "^3.0.0", "moment": "^2.29.4", "react-dnd-html5-backend": "^16.0.1", - "react-router-dom": "^6.4.3", + "react-router-dom": "^6.14.1", "styled-components": "^5.3.6", "styled-system": "^5.1.5", "urbit-ob": "^5.0.1", diff --git a/trove/src/Trove.tsx b/trove/src/Trove.tsx index 3c0c060a7f..7218cb091d 100644 --- a/trove/src/Trove.tsx +++ b/trove/src/Trove.tsx @@ -1,5 +1,5 @@ import { useEffect } from 'react'; -import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; +import { BrowserRouter, redirect, Route, Routes } from 'react-router-dom'; import { createTheme, ThemeProvider } from '@mui/material/styles'; import { trovePreload } from '../../app/src/os/services/ship/trove.service'; @@ -53,6 +53,11 @@ export const Trove = ({ const space = useTroveStore((store: TroveStore) => store.space); const setApi = useTroveStore((store: TroveStore) => store.setApi); + useEffect(() => { + // Start at the root path. + redirect('/'); + }, []); + useEffect(() => { //subscribe to updates here TroveIPC.UIUpdates(); @@ -90,11 +95,11 @@ export const Trove = ({ }} > - + }> Enter a space in the url example: ...apps/trove/~zod/our } /> - + ); diff --git a/trove/src/components/NavigationHeader.tsx b/trove/src/components/NavigationHeader.tsx index 8699324266..13e7c281a2 100644 --- a/trove/src/components/NavigationHeader.tsx +++ b/trove/src/components/NavigationHeader.tsx @@ -7,6 +7,7 @@ import { WrappedBackground } from '../components'; import { splitLastOccurrence } from '../helpers'; import useTroveStore, { TroveStore } from '../store/troveStore'; import { theme } from '../theme'; + export const NavigationHeader = () => { const currentSpace = useTroveStore((store: TroveStore) => store.currentSpace); const [stlfDisplay, setStflDisplay] = useState(''); diff --git a/yarn.lock b/yarn.lock index 457c34554f..7ef08b202e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17274,7 +17274,7 @@ react-remove-scroll@2.5.5: use-callback-ref "^1.3.0" use-sidecar "^1.1.2" -react-router-dom@^6.4.3: +react-router-dom@^6.14.1: version "6.14.1" resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.14.1.tgz#0ad7ba7abdf75baa61169d49f096f0494907a36f" integrity sha512-ssF6M5UkQjHK70fgukCJyjlda0Dgono2QGwqGvuk7D+EDGHdacEN3Yke2LTMjkrpHuFwBfDFsEjGVXBDmL+bWw==