cashonize / cashonize-wallet

Cashonize: A cross-platform Bitcoin Cash Wallet
https://cashonize.com
7 stars 5 forks source link

issue: race-condition for initializing stores when using URL params #24

Closed mr-zwets closed 2 weeks ago

mr-zwets commented 1 month ago

Currently there can be a race condition where Cashonize hasn't initialized yet, see: https://github.com/cashonize/cashonize-wallet/blob/main/src/pages/WalletPage.vue#L43

@jimtendo suggested 3 possible fixes

  1. to use a boot file to initialize the store, /boot/... files run before any components/pages are mounted

  2. might be able to replace the code above with something in the stores/store.ts that just uses JS (or Vue router) to read the URL after WC and CC are initialized.

  3. as a hotfix, could increase the timeout

I haven't run into the race-condition while testing

jimtendo commented 1 month ago

I'm in Australia, so probably a few more network hops away from most services relative to Europe.

Occasionally, I do slip under the 500ms, but generally it's a miss from where I'm located.

A few timings measured below (most seem to hover between 1000ms-1500ms from here... 2000ms+ appears infrequent):

image

image

image

mr-zwets commented 2 weeks ago

this issue should now be resolved (as of v0.2.3) with method 2. so without the need for a boot-file.

Thanks @jimtendo for helping with the fix!