Improve handling of routes and screens. Fix issue which could prevent logging in depending on order of screens in app definition
This commit is contained in:
parent
88e6da5e49
commit
5130bdf3cd
|
@ -3,7 +3,7 @@
|
||||||
"version": "0.3.8",
|
"version": "0.3.8",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"main": "dist/budibase-client.js",
|
"main": "dist/budibase-client.js",
|
||||||
"module": "dist/budibase-client.esm.mjs",
|
"module": "dist/budibase-client.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup -c",
|
"build": "rollup -c",
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
|
|
|
@ -34,7 +34,7 @@ const createRouteStore = () => {
|
||||||
}
|
}
|
||||||
const setActiveRoute = route => {
|
const setActiveRoute = route => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.activeRoute = route
|
state.activeRoute = state.routes.find(x => x.path === route)
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@ const createScreenStore = () => {
|
||||||
activeLayout = layouts[0]
|
activeLayout = layouts[0]
|
||||||
if (screens.length === 1) {
|
if (screens.length === 1) {
|
||||||
activeScreen = screens[0]
|
activeScreen = screens[0]
|
||||||
} else {
|
} else if ($routeStore.activeRoute) {
|
||||||
activeScreen = screens.find(
|
activeScreen = screens.find(
|
||||||
screen => screen.routing.route === $routeStore.activeRoute
|
screen => screen._id === $routeStore.activeRoute.screenId
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (activeScreen) {
|
if (activeScreen) {
|
||||||
|
|
Loading…
Reference in New Issue