From a85c1570038c14f99a3a18219ed2ab4a11f5d26c Mon Sep 17 00:00:00 2001 From: srgooglo Date: Sat, 4 Jun 2022 21:14:19 +0200 Subject: [PATCH] implement `forceUpdate` event --- packages/app/src/router.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/app/src/router.jsx b/packages/app/src/router.jsx index c02e36f3..9acd9ea6 100644 --- a/packages/app/src/router.jsx +++ b/packages/app/src/router.jsx @@ -61,6 +61,7 @@ export function BindContexts(component) { export const InternalRouter = withRouter((props) => { const defaultTransitionDelay = 150 + const forceUpdate = React.useReducer(() => ({}))[1] React.useEffect(() => { props.history.listen((event) => { @@ -94,6 +95,10 @@ export const InternalRouter = withRouter((props) => { }, delay ?? defaultTransitionDelay) } + window.app.eventBus.on(`router.forceUpdate`, forceUpdate) + + props.history.lastLocation = window.location + window.app.setLocation = props.history.setLocation }, [])