citycoins / ui

Basic UI components for interacting with the CityCoin contract. Requires Stacks Wallet for Web.
https://minecitycoins.com
GNU General Public License v3.0
28 stars 13 forks source link

⚡[FEAT] Detect stale data #154

Open whoabuddy opened 2 years ago

whoabuddy commented 2 years ago

*Is your feature request related to a problem? Please describe.

Given the API pulls data from a pool of available nodes, and assuming multiple APIs could be used in the future, there is a small chance stale data can appear if a node is out of sync.

unknown

Describe the solution you'd like

Use a simple KV entry that tracks the current block on each query.

If the next query matches the block height, do nothing.

If the next query is a higher block height, update KV.

If the next query is a lower block height, display a modal/warning for potentially stale data.

Describe alternatives you've considered

Displaying a warning feels better then blocking or re-fetching the data automatically, so loading times stay consistent.

It's also an edge case, but gets more interesting if people are able to change which API they use.

Additional context

None.