fuels-wallet
fuels-wallet copied to clipboard
fix: vault server lock propagation
Context
useUnlock
listens for lock
and unlock
events from VaultClient, but the communication with VaultServer was one-way, meaning those events from the Server never reached the client. That means that a lock changes from server-side would never be reflected in our UI.
In that scenario the wallet locks but the user wouldn't be redirected to the auth screen, being able to keep interacting with UI elements behind the auth guard, leading to several bugs.
Solution
Fixed by using propagating VaultServer lock change events to VaultClient through existing communication protocol, VaultClient further propagates those events, which are now correctly handled by useUnlock
, leading to proper behavior (e.g. redirection to the auth screen).
Evidence
Before
https://github.com/FuelLabs/fuels-wallet/assets/3487334/c85944cc-fe7e-4a62-a670-4414d790dc98
After
https://github.com/FuelLabs/fuels-wallet/assets/3487334/1de77275-b18d-474f-b3bb-e32153832d2e
Coverage report for ./packages/app
St.:grey_question: |
Category | Percentage | Covered / Total |
---|---|---|---|
π‘ | Statements | 62.49% | 3233/5174 |
π΄ | Branches | 41.91% | 627/1496 |
π΄ | Functions | 47.01% | 685/1457 |
π‘ | Lines | 63.04% | 3115/4941 |
Test suite run success
240 tests passing in 70 suites.
Report generated by π§ͺjest coverage report action from 4bac9e731c521ede972bccbc9f7b3b0cf219e73d