Skip to content

How to force page loading based on some condition? #155

Answered by raquo
IgorWolkov asked this question in Q&A
Discussion options

You must be logged in to vote

Why do you need forcePage? That method's purpose does not seem to match your use case.

Are you perhaps looking for router.pushState(RestrictedPageView.page)?

BTW, unrelatedly, OneTimeOwner(() => {}) is a memory leak. on every request you're creating an owner and a subscription that you never clean up. For network requests you can do something like:

  val owner = new ManualOwner()
  rest.callLoginApi(state.now().login, state.now().password)
        .foreach {
          case ApiResponse.Result(_) =>
            owner.killSubscriptions()
            ...
          case _  =>
            owner.killSubscriptions()
        }(owner)

that way when you get the response, you clean up the subscription.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@IgorWolkov
Comment options

@IgorWolkov
Comment options

@raquo
Comment options

@IgorWolkov
Comment options

Answer selected by IgorWolkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants