arj03 / ssb-browser-demo

A secure scuttlebutt client interface running in the browser
Other
58 stars 11 forks source link

Event-driven autorefresh on Public tab #119

Closed KyleMaas closed 3 years ago

KyleMaas commented 3 years ago

Instead of figuring out autorefresh on the Public tab, this version does it the new-public-messages component. The idea is that when a new message comes in, it checks to see if autorefresh is enabled and, if so, refreshes. But then it blocks autorefreshing for 30 seconds. At the end of that timer, it rechecks in case a message came in while it was blocked, and then it unblocks autorefreshing so the next message can refresh immediately.

The reason for the timer is because when you're doing a major sync operation it could otherwise trigger a whole bunch of refresh requests in a very short amount of time (it did this the first time I tried it). So I think we still need a timer, but it needs to block instead of being the primary motivation for action.

So, does that look like an acceptable way to do it?

KyleMaas commented 3 years ago

I think this should fix #114

KyleMaas commented 3 years ago

Does this look like a reasonable way to do it?

KyleMaas commented 3 years ago

Changed

arj03 commented 3 years ago

Thanks :)

KyleMaas commented 3 years ago

Have you had a chance to try this out yet and see how it works for you? Because if this method is suitable, I'd like to try to apply it to Private, Thread, and Channel as well. If it isn't, I'd like to file an issue so I know what needs work.

arj03 commented 3 years ago

Seems to be working much better now

KyleMaas commented 3 years ago

Cool. Then I will see if I can get this implemented on the other pages for consistency.