create-athenea-app 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { LocationProvider, Router, Route } from 'preact-iso'
|
|
2
2
|
import Home from './routes/Home/Home'
|
|
3
3
|
|
|
4
|
+
/** Reads the `route` query param (used by main-process child windows) so the
|
|
5
|
+
* renderer navigates to the requested route on startup instead of always
|
|
6
|
+
* resolving to the current `location.pathname`. */
|
|
7
|
+
function getInitialUrl() {
|
|
8
|
+
const params = new URLSearchParams(location.search)
|
|
9
|
+
const route = params.get('route')
|
|
10
|
+
return route || location.pathname + location.search
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
export default function App() {
|
|
5
14
|
return (
|
|
6
|
-
<LocationProvider>
|
|
15
|
+
<LocationProvider url={getInitialUrl()}>
|
|
7
16
|
<Router>
|
|
8
17
|
<Route path="/" component={Home} />
|
|
9
18
|
<Route default component={Home} />
|