fuels-wallet icon indicating copy to clipboard operation
fuels-wallet copied to clipboard

fix: vault server lock propagation

Open arthurgeron opened this issue 9 months ago β€’ 1 comments

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

arthurgeron avatar May 06 '24 23:05 arthurgeron

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

github-actions[bot] avatar May 07 '24 16:05 github-actions[bot]