mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-24 01:22:24 +03:00
Wrap all react-router routes with Switch (#1188)
This commit is contained in:
parent
ef10d37357
commit
53ee9297f9
@ -4,6 +4,7 @@
|
||||
|
||||
### Bug fixes
|
||||
- Wasp CLI will now forward error exit codes. This will help when used in scripted contexts.
|
||||
- Wasp now renders only the first route that matches the current path in the browser.
|
||||
|
||||
### Express middleware customization
|
||||
We now offer the ability to customize Express middleware:
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{={= =}=}}
|
||||
import React from 'react'
|
||||
import { Route, BrowserRouter as Router } from 'react-router-dom'
|
||||
import { Route, Switch, BrowserRouter as Router } from 'react-router-dom'
|
||||
{=# rootComponent.isDefined =}
|
||||
{=& rootComponent.importStatement =}
|
||||
{=/ rootComponent.isDefined =}
|
||||
@ -22,9 +22,7 @@ const router = (
|
||||
{=# rootComponent.isDefined =}
|
||||
<{= rootComponent.importIdentifier =}>
|
||||
{=/ rootComponent.isDefined =}
|
||||
{=^ rootComponent.isDefined =}
|
||||
<>
|
||||
{=/ rootComponent.isDefined =}
|
||||
<Switch>
|
||||
{=# routes =}
|
||||
<Route exact path="{= urlPath =}" component={ {= targetComponent =} }/>
|
||||
{=/ routes =}
|
||||
@ -37,12 +35,10 @@ const router = (
|
||||
{=/ authProviderEnabled =}
|
||||
{=/ externalAuthProviders =}
|
||||
{=/ isExternalAuthEnabled =}
|
||||
</Switch>
|
||||
{=# rootComponent.isDefined =}
|
||||
</{= rootComponent.importIdentifier =}>
|
||||
{=/ rootComponent.isDefined =}
|
||||
{=^ rootComponent.isDefined =}
|
||||
</>
|
||||
{=/ rootComponent.isDefined =}
|
||||
</Router>
|
||||
)
|
||||
|
||||
|
@ -473,7 +473,7 @@
|
||||
"file",
|
||||
"web-app/src/router.jsx"
|
||||
],
|
||||
"103724de16eb74300d9fab366bf73401ffd6bf9018394044c1d4ade22731868e"
|
||||
"c1188ee948f821f5e3e7e741f54b503afffe4bdb24b8f528c32aee0990cf5457"
|
||||
],
|
||||
[
|
||||
[
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { Route, BrowserRouter as Router } from 'react-router-dom'
|
||||
import { Route, Switch, BrowserRouter as Router } from 'react-router-dom'
|
||||
|
||||
|
||||
import MainPage from './ext-src/MainPage.jsx'
|
||||
@ -7,9 +7,9 @@ import MainPage from './ext-src/MainPage.jsx'
|
||||
|
||||
const router = (
|
||||
<Router>
|
||||
<>
|
||||
<Switch>
|
||||
<Route exact path="/" component={ MainPage }/>
|
||||
</>
|
||||
</Switch>
|
||||
</Router>
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
app waspBuild {
|
||||
db: { system: PostgreSQL },
|
||||
wasp: {
|
||||
version: "^0.10.4"
|
||||
version: "^0.10.5"
|
||||
},
|
||||
title: "waspBuild"
|
||||
}
|
||||
|
@ -487,7 +487,7 @@
|
||||
"file",
|
||||
"web-app/src/router.jsx"
|
||||
],
|
||||
"103724de16eb74300d9fab366bf73401ffd6bf9018394044c1d4ade22731868e"
|
||||
"c1188ee948f821f5e3e7e741f54b503afffe4bdb24b8f528c32aee0990cf5457"
|
||||
],
|
||||
[
|
||||
[
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { Route, BrowserRouter as Router } from 'react-router-dom'
|
||||
import { Route, Switch, BrowserRouter as Router } from 'react-router-dom'
|
||||
|
||||
|
||||
import MainPage from './ext-src/MainPage.jsx'
|
||||
@ -7,9 +7,9 @@ import MainPage from './ext-src/MainPage.jsx'
|
||||
|
||||
const router = (
|
||||
<Router>
|
||||
<>
|
||||
<Switch>
|
||||
<Route exact path="/" component={ MainPage }/>
|
||||
</>
|
||||
</Switch>
|
||||
</Router>
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspCompile {
|
||||
wasp: {
|
||||
version: "^0.10.4"
|
||||
version: "^0.10.5"
|
||||
},
|
||||
title: "waspCompile"
|
||||
}
|
||||
|
@ -858,7 +858,7 @@
|
||||
"file",
|
||||
"web-app/src/router.jsx"
|
||||
],
|
||||
"5c34b729d2244c792086224a6fae18c7bdfc029098a1fff9fe1685ba40af9d9b"
|
||||
"ba66454c9f0ca79ed5bc6af694b5b9f748db75cf82309f2600c78069a3b9d0f7"
|
||||
],
|
||||
[
|
||||
[
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { Route, BrowserRouter as Router } from 'react-router-dom'
|
||||
import { Route, Switch, BrowserRouter as Router } from 'react-router-dom'
|
||||
import App from './ext-src/App.jsx'
|
||||
|
||||
import createAuthRequiredPage from "./auth/pages/createAuthRequiredPage"
|
||||
@ -11,10 +11,12 @@ import OAuthCodeExchange from "./auth/pages/OAuthCodeExchange"
|
||||
const router = (
|
||||
<Router>
|
||||
<App>
|
||||
<Switch>
|
||||
<Route exact path="/" component={ MainPage }/>
|
||||
<Route exact path="/auth/login/google">
|
||||
<OAuthCodeExchange pathToApiServerRouteHandlingOauthRedirect="/auth/google/callback" />
|
||||
</Route>
|
||||
</Switch>
|
||||
</App>
|
||||
</Router>
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
app waspComplexTest {
|
||||
db: { system: PostgreSQL },
|
||||
wasp: {
|
||||
version: "^0.10.4"
|
||||
version: "^0.10.5"
|
||||
},
|
||||
auth: {
|
||||
userEntity: User,
|
||||
|
@ -501,7 +501,7 @@
|
||||
"file",
|
||||
"web-app/src/router.jsx"
|
||||
],
|
||||
"103724de16eb74300d9fab366bf73401ffd6bf9018394044c1d4ade22731868e"
|
||||
"c1188ee948f821f5e3e7e741f54b503afffe4bdb24b8f528c32aee0990cf5457"
|
||||
],
|
||||
[
|
||||
[
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { Route, BrowserRouter as Router } from 'react-router-dom'
|
||||
import { Route, Switch, BrowserRouter as Router } from 'react-router-dom'
|
||||
|
||||
|
||||
import MainPage from './ext-src/MainPage.jsx'
|
||||
@ -7,9 +7,9 @@ import MainPage from './ext-src/MainPage.jsx'
|
||||
|
||||
const router = (
|
||||
<Router>
|
||||
<>
|
||||
<Switch>
|
||||
<Route exact path="/" component={ MainPage }/>
|
||||
</>
|
||||
</Switch>
|
||||
</Router>
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
app waspJob {
|
||||
db: { system: PostgreSQL },
|
||||
wasp: {
|
||||
version: "^0.10.4"
|
||||
version: "^0.10.5"
|
||||
},
|
||||
title: "waspJob"
|
||||
}
|
||||
|
@ -487,7 +487,7 @@
|
||||
"file",
|
||||
"web-app/src/router.jsx"
|
||||
],
|
||||
"103724de16eb74300d9fab366bf73401ffd6bf9018394044c1d4ade22731868e"
|
||||
"c1188ee948f821f5e3e7e741f54b503afffe4bdb24b8f528c32aee0990cf5457"
|
||||
],
|
||||
[
|
||||
[
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { Route, BrowserRouter as Router } from 'react-router-dom'
|
||||
import { Route, Switch, BrowserRouter as Router } from 'react-router-dom'
|
||||
|
||||
|
||||
import MainPage from './ext-src/MainPage.jsx'
|
||||
@ -7,9 +7,9 @@ import MainPage from './ext-src/MainPage.jsx'
|
||||
|
||||
const router = (
|
||||
<Router>
|
||||
<>
|
||||
<Switch>
|
||||
<Route exact path="/" component={ MainPage }/>
|
||||
</>
|
||||
</Switch>
|
||||
</Router>
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspMigrate {
|
||||
wasp: {
|
||||
version: "^0.10.4"
|
||||
version: "^0.10.5"
|
||||
},
|
||||
title: "waspMigrate"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
app waspNew {
|
||||
wasp: {
|
||||
version: "^0.10.4"
|
||||
version: "^0.10.5"
|
||||
},
|
||||
title: "waspNew"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ cabal-version: 2.4
|
||||
-- Consider using hpack, or maybe even hpack-dhall.
|
||||
|
||||
name: waspc
|
||||
version: 0.10.4
|
||||
version: 0.10.5
|
||||
description: Please see the README on GitHub at <https://github.com/wasp-lang/wasp/waspc#readme>
|
||||
homepage: https://github.com/wasp-lang/wasp/waspc#readme
|
||||
bug-reports: https://github.com/wasp-lang/wasp/issues
|
||||
|
Loading…
Reference in New Issue
Block a user