impierce / identity-wallet

A Tauri-based Identity Wallet for people to manage Decentralized Identities and Verifiable Credentials.
https://www.impierce.com
Apache License 2.0
26 stars 3 forks source link

Wrong route gets served #246

Open maiertech opened 5 months ago

maiertech commented 5 months ago

Description

When running UniMe in dev on macOS, occasionally, it looks like SvelteKit serves the wrong route. This can happen in different routes.

Hardware Specification

Happens in development on macOS.

Steps to Reproduce the Bug

This bug was observed by @daniel-mader and @maiertech. Both have not managed to find a reproduction.

Expected Behaviour

In the animated GIF I am on route /welcome/password and click on the continue button. I expect to be taken to route /welcome/password/confirm.

Actual Behaviour

When I am on route /welcome/password I click on the continue button and unexpectedly see route /welcome/pledge:

unime-ezgif com-crop

Errors

No errors in the logs.

maiertech commented 5 months ago

When I log SvelteKit's navigating store and then click on the continue button on route /welcome/password, I see the following object:

{
  complete: Promise {status: "fulfilled", result: undefined},
  from: {params: {}, route: {id: "/welcome/password"}, url: URL},
  to: {params: {}, route: {id: "/welcome/password/confirm"}, url: URL},
  type: "goto",
  willUnload: false
}

This is the correct object, i.e. SvelteKit does not navigate to /welcome/pledge. When I output $page.url.pathname in the root layout, I see /welcome/password/confirm when SvelteKit is done navigating, but with the content of /welcome/pledge.

This makes me believe that this is some esoteric Safari caching problem.

The workaround is to disable caches in the Network tab in Safari's DevTools:

disable-cache

maiertech commented 5 months ago

For now, wait and see if we can reproduce this in the future.

maiertech commented 5 months ago

This is another instance of a wrong route getting served in dev. The app routes from the password confirmation screen back to the password confirmation screen. This is not because the passwords don't match. After the second password confirmation attempt, the Continue button freezes.

tauri-bug

Console

There are no logs in the console that give a hint on what is going wrong.

$navigating store

When on route /welcome/password/confirm for the first time and when clicking Continue (after validation passes), the navigating store looks like this:

{
  complete: Promise {status: "pending"},
  from: {params: {}, route: {id: "/welcome/password/confirm"}, url: URL},
  to: {params: {}, route: {id: "/welcome/password/completed"}, url: URL},
  type: "goto",
  willUnload: false
}

Again, SvelteKit navigates to the correct route, but the wrong UI is visible. The second time, navigating looks like this

{
  complete: Promise {status: "fulfilled", result: undefined},
  from: {params: {}, route: {id: "/welcome/password/completed"}, url: URL},
  to: {params: {}, route: {id: "/welcome/password/completed"}, url: URL},
  type: "goto",
  willUnload: false
}

This is correct given what UI is shown, but makes no sense.

As a workaround, disable the cache as described in a comment further up.

Oran-Dan commented 4 months ago

I encounter the exact same problem as described in the main description on Ubuntu 22.04.

maiertech commented 3 months ago

The root cause is still unclear and still not reproducible.

It might be related to how Tauri listen is configured, or a backend-triggered redirect interfering with an unrelated ongoing SvelteKit navigation.

I will try wiring up Tauri listen in the root layout onMount and let it handle backend-triggered redirects.

maiertech commented 3 months ago

Wire up Tauri listeners in onMount of root layout: https://github.com/impierce/identity-wallet/pull/322.

May not fix this, but it's cleaner and easier to understand.

Oran-Dan commented 3 months ago

New instance of a wrong route, this is on branch `chore/bump-did-manager. clicking Me - Profile icon top left - My profile - Profile name.

Screencast from 08-08-24 16:06:04.webm

maiertech commented 2 months ago

Accidentally closed. Reopening.