Closed sidhujag closed 2 years ago
We are monitoring the wallet state on this part of the code.
onWalletUpdate
based on example: https://docs.paliwallet.com/guide/Wallet.html#onwalletupdate
https://github.com/osiastedian/syscoin-bridge/blob/main/contexts/PaliWallet/Provider.tsx#L101
We then store the walletState
and derive the balance from there on this line:
https://github.com/osiastedian/syscoin-bridge/blob/main/contexts/PaliWallet/Provider.tsx#L222
can you also trigger calling wallet balance when you load the section of site that reads balance
@sidhujag
Added fix above to use react-query
https://github.com/osiastedian/syscoin-bridge/commit/a09d32d74dad08716c7fff6cdeb26d9b955545ec
Should fetch on window focus which is an event fired after interacting with PaliWallet.
Added a refetch interval of every 1s incase there are other background transactions done outside bridge.
Doesn't work, this change introduces a new bug:
Go to new transfer page, goto pali send sys from account 1 to account 2, go back to new transfer page and your page will be now stuck, try to go to my transfers and it will be stuck loading or really slow (even get 500 sometimes)
Okay. will revert fix and try to another.
@sidhujag
Updated loading of controller.
@osiastedian why do you register that callback once, that is the fix because on multiple loads there becomes multiple callbacks? shouldn't the callback state be destroyed when you switch context so you can register again next time you goto that screen?
@sidhujag
So PaliWalletContext
is available on AppLevel as a Singleton context and ideally should just load the controller once upon initialization of the app.
So why if its singleton do you still check and register it once explicitly? How does that fix it?
Yeah debugged it and the cause was the dependency array was incorrect.
I've been calling "setController" but it doesn't really take effect since it was not declared on the deps array.
ok cool
When is Pali balance updated in the site? i had 0.09 but then i did 2 0.1 transfers from NEVM to SYS and I have 0.29.. but the website kept showing 0.09 until i opened Pali then it updated the balance on the site, possible to update Pali balance when you click on the site sections which show the balance?