Skip to content

Commit

Permalink
Wrap router actions in startTransition
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-vrijswijk committed Jul 25, 2024
1 parent 62712af commit b9ba9de
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import japgolly.scalajs.react.util.DefaultEffects
import japgolly.scalajs.react.util.Effect.Sync
import japgolly.scalajs.react.util.Util.identityFn
import japgolly.scalajs.react.vdom.VdomElement
import japgolly.scalajs.react.React.startTransition
import org.scalajs.dom
import scala.scalajs.js

Expand Down Expand Up @@ -50,7 +51,7 @@ object RouterWithProps {
.render ($ => lgc.render($.state, $.props))
.componentDidMount ($ => cfg.postRenderFn(None, $.state.page, $.props))
.componentDidUpdate (i => cfg.postRenderFn(Some(i.prevState.page), i.currentState.page, i.currentProps))
.configure (ListenableF.listenToUnit(_ => lgc, $ => F.flatMap(lgc.syncToWindowUrl)(s => F.transSync($.setState(s)))))
.configure (ListenableF.listenToUnit(_ => lgc, $ => F.flatMap(lgc.syncToWindowUrl)(s => startTransition(F.transSync($.setState(s))))))
.configure (EL.install_("popstate", lgc.ctl.refresh, dom.window))
.configureWhen(isIE11())(EL.install_("hashchange", lgc.ctl.refresh, dom.window))
}
Expand Down

0 comments on commit b9ba9de

Please sign in to comment.