Page MenuHomePhabricator

[Cashtab] [Alias] Real time update of Registered Aliases list upon new registration
ClosedPublic

Authored by emack on Mar 10 2023, 06:01.

Details

Summary

Currently when registering a new alias it won't appear in the Registered Aliases section of Alias.js until 1) alias cache has re-synchronized and 2) page refresh. This diff ensures both occurs upon successful broadcast of a registration so users are not left wondering whether their registration was successful or not.

Test Plan
  • enable Alias to true in ticker.js
  • npm start
  • navigate to Alias.js and register a new alias. Observe it is displayed

Diff Detail

Repository
rABC Bitcoin ABC
Branch
instantAliasRefresh
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22387
Build 44400: Build Diffcashtab-tests
Build 44399: arc lint + arc unit

Event Timeline

emack requested review of this revision.Mar 10 2023, 06:01
bytesofman added inline comments.
web/cashtab/src/components/Alias/Alias.js
78 ↗(On Diff #38373)

remove aliasRefreshTrigger flag

126 ↗(On Diff #38373)

remove flag

181 ↗(On Diff #38373)

Issue with this flag approach

User story

  • Register an alias
  • Flag is set to true
  • This alias instantly is rendered
  • Register another alias
  • Flag is still set to true
  • No change when it is reset to rue
  • the useEffect loop is not entered again, this alias does not show up

Instead of using the flag to force a re-entry to the useEffect loop, just add the alias to the screen as pending.

This is kind of hacky but imo a user friendly first step. The "right" way to do this, which will be quite nice when we get it in, is to use our existing websocket connection to monitor for when this tx confirms, and then (if it is indeed valid), remove the pending.

So, instead of setAliasRefreshTrigger(true);

setActiveWalletAliases([...activeWalletAliases, `${aliasInput} (pending)`])
This revision now requires changes to proceed.Mar 10 2023, 23:48
emack marked 3 inline comments as done.

Removed aliasRefreshTrigger and adopted the temporary ${aliasInput} (pending) approach. However it's coming up as undefined.xec which is presumably due to a a refresh occuring immediately before it. Removing the synchronizeAliasCache call after successful registration broadcast didn't resolve it either. Still investigating what is interferring with this activeWalletAliases state variable.

Updated to a refresh toggle as per tg chat

removed redundant state variable change

This revision is now accepted and ready to land.Mar 12 2023, 22:09