mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-25 16:45:42 +00:00
* [NO GBP] NumberInput patches (#82000) ## About The Pull Request 1. Removes event parameter (`e`) from `onChange()` & `onDrag()` for 2 reasons - The event cannot be statically typed because it's called when you both either hit the enter key(it's a keyboard event) & during dragging (now it's a mouse event). Currently there is no code that depends on this object and even if it did type checking for which type of event is a pain so this isn't the right way to provide that data - The event is stale/has wrong data when dragging has started. This is because when dragging begins it calls `setInterval()` which keeps reusing the event object from that 1 time click and not the event data while dragging thus the data is stale and should be discarded & not passed to user 2. Removed `suppressFlickering` from Number Input. This was only used by Atmos monitoring console and the comment explaining why it was used was also wrong (there is no such asynchronous call in the back end). What this var did was difficult to understand anyway and after removing its only 1 use we can clean it up with no side effects. 3. Removed `updateRate`. Not used anywhere and a constant of 400ms should be sufficient for most purposes anyway 4. Fixes #81995. Dragging the Number Input will only send data to the back end if that value changes & not send the same value every 400ms. Simple logic (compare old value with the new) and yet efficient results, This applies when you hit enter or click outside of the field as well 5. You can once again drag your mouse anywhere in the window outside the number input field to vary the value by large amounts ## Changelog 🆑 fix: number input dragging will only send payload to backend when its value changes, Same applies when you hit enter or click outside the field, the value must have changed to trigger the back end fix: You can once again drag your mouse anywhere in the window outside the number input field to vary the value by large amounts code: removed unnecessary variables(suppressFlickering, updateRate & event object param for handlers) from Number Input /🆑 * [NO GBP] NumberInput patches * Ohhh, right. --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>