Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed Nov 23, 2022
1 parent 62f27a4 commit 421ac58
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,9 @@ export const router = kea<routerType>([

export function getRouterContext(): RouterPluginContext {
let context: RouterPluginContext | undefined = getPluginContext('router')
if (!context || !context.history || !context.location) {
const defaultContext = getDefaultContext()
if (!context) {
context = defaultContext
setRouterContext(context)
} else {
if (!context.history) {
context.history = defaultContext.history
}
if (!context.location) {
context.location = defaultContext.location
}
}
if (!context.history || !context.location || Object.keys(context).length === 0) {
context = { ...getDefaultContext(), ...context }
setRouterContext(context)
}
return context
}
Expand Down

0 comments on commit 421ac58

Please sign in to comment.