Open zone117x opened 5 years ago
@timstackblock Would you consider this bug P2 or P3?
@yknl I see you added this to a DX sprint a few months ago – was progress made?
@hstove are these fixes we can make implicitly as part of the rebuild?
The latest update to blockstack.js and Gaia that improves concurrency may help with this issue, but some browser changes are required. https://github.com/blockstack/blockstack.js/pull/743
Related to https://github.com/blockstack/blockstack-browser/issues/1745 @timstackblock and I decided to open a new issue for this since the bug(s) and solution(s) may be a superset of the original issue.
Several actions performed within a blockstack-browser tab cause a cached outdated profile.json to overwrite any changes made from another tab.
Reproducible Example
publish_data
scope - look up your profile.json to see the app added. e.g.:https://core.blockstack.org/v1/names/zone117x.id
->https://gaia.blockstack.org/hub/1Nw25PemCRv24UQAcZdaj4uD11nkTCWRTE/profile.json
Potential Fix
Adherence to the
single source of truth
principle.name
while it is pending registration, or display UI quickly while latest data is being fetched).fetch latest
->change only the intended profile fields
->upload the updated profile
.fetch latest profile
function should always attempt a fresh resolution starting with the source of truth (the identityaddress
) so that name/zonefile updates are respected.identity[0]
and/or whatever the global app state API setting happens to represent.Demo code example
Stale UI in a tab
(This may need to be moved to a new issue)
Typical user behavior could involve having the blockstack-browser webpage open in a perma-tab. Or several tabs, in potentially different web browsers / devices.
The Page Visibility API https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API could be used to prevent a browser tab state from becoming stale.
A simple
document.onvisibilitychange
hook can be used to fetch possibly updated profile data, without having to perform something like constant polling.