hemilabs / ui-monorepo

UI monorepo for Hemi Labs
MIT License
2 stars 1 forks source link

Research web workers as an alternative to update transaction history #390

Closed gndelia closed 2 months ago

gndelia commented 3 months ago

Currently, we have some components (with no UI) that check the current history and update the status of the Transactions.

These requests take place in the background of the user UI and make the app constantly work even though the user is not doing anything. The updates are written to local storage.

One option could be to use web workers so all the work and processing could be handed off to a background process, that can periodically post messages to the user app to record the new information in local storage. As web workers are running in a separated thread of the browser, they will remove part of the heavy lift of querying tons of APIs.

Review if this approach is possible, as it may separate the process of syncing transactions of the proper app (Another benefit: This will run outside of React, so it will reduce part of the complexity greatly)

gabmontes commented 3 months ago

After some quick research, I think this is totally doable. A web worker can be instantiated, it can query a public RPC to get the required data, then post that back to the main thread. The end result would be a smoother UI but the actual UX benefit is still unclear.

gndelia commented 2 months ago

Web workers were implemented to sync past deposits/withdrawals for Sepolia, and Deposits for bitcoin. This is also in production, so I'm closing