ben-miles / subnauticapda

An unofficial second-screen companion app for the game "Subnautica."
https://subnauticapda.dev
Other
0 stars 0 forks source link

Debounce Notes Call to Set localStorage #24

Closed ben-miles closed 2 months ago

ben-miles commented 2 months ago

Right now, localStorage is updated with the value of the Notes textarea immediately, upon every keypress. As far as I understand, this is all happening client-side and so no data is being sent over the internet, so maybe it's fine. I'd like to figure out for sure if this kind of thing is bad for performance in any way, and if so, optimize it -- perhaps by delaying the save til a second or two after the last keypress.

ben-miles commented 2 months ago

Upon a little further research, this is totally unnecessary here. Debouncing is great for when you're incurring a new call to a remote server on every action, but the way I've set things up here, I have only one call to the server when the app first loads -- After that, every change to the filter/search input represents a change to data that has already been downloaded.