[V6] Routing not working in Vue3 onMounted

Hello F7 community,

We have an issues when we trying to route in onMounted (Vue3). It doesn’t work unless we add a delay like 300ms via setTimeout(() => null, 300). We even tried wrapping it in f7Ready((f7) => <code here>) and using f7.utils.nextTick() what are we doing wrong?

How to replicate:

This is still an actual issue.

@nolimits4web can you please explain why this is happening? What is the technical reason for this behaviour and what would can we fix this?

Same issue, other topic: How to route directly to another page when page is loaded - Questions - Framework7 Forum

While it is a solution to use the beforeEnter callback on the router, it is not always a solution that can be used.

here => strange-matsumoto-gckewm - CodeSandbox
i’m not a vue guy, but the logic is the same

is short:
navigate is expensive,
and allowPageChange make sure nothing-strange-happens in the between.

you should never override allowPageChange (strange things will happen).
and there is no much sense to navigate to ‘page-Y’ when what you really want is ‘page-X’.

1 Like

I cannot access your Sandbox, correct?