oddsdk / odd-app-template

A sveltekit web app template for the ODD SDK.
https://odd-template.fission.app
MIT License
29 stars 10 forks source link

Fix account linking issues #128

Closed bgins closed 1 year ago

bgins commented 1 year ago

Description

This PR fixes account linking bugs.

Failed to fetch root DID

The account linking consumer is initialized a second time after account linking. It seems the link-device page is loaded a second time.

The fix here is guarding the initialization call when we have a session, which prevents the account linking consumer from starting unnecessarily.

https://github.com/oddsdk/odd-app-template/blob/435a235ae68c9fa01df4f176c93b427c2253718f/src/routes/link-device/%2Bpage.svelte#L58-L60

Could not parse a valid private tree using the given key

The file system data root may not be available immediately after linking completes. This issue is documented in https://github.com/oddsdk/ts-odd/issues/529. When this issue occurs, the result is a Error: Could not parse a valid private tree using the given key, but only after a reload.

The fix for this issue is waiting in the account linking consumer until the data root is available (when it is a non-empty CID).

Type of change

Testing

Create a new account and link it on a second device immediately and as quickly as possible. No errors should occur and the file system should load and work as expected.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
odd-app-template ✅ Ready (Inspect) Visit Preview Jun 20, 2023 6:03pm