Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] NumberInput patches #2547

Merged
merged 3 commits into from
Mar 25, 2024
Merged

[MIRROR] NumberInput patches #2547

merged 3 commits into from
Mar 25, 2024

Conversation

Steals-The-PRs
Copy link
Collaborator

Mirrored on Nova: NovaSector/NovaSector#1601
Original PR: tgstation/tgstation#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

🆑 SyncIt21
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
/:cl:

[NO GBP] NumberInput patches

Co-authored-by: SyncIt21 <[email protected]>
Co-authored-by: Bloop <[email protected]>
@Steals-The-PRs Steals-The-PRs added Mirroring conflict git cherry-pick во что-то уткнулся. Не ставить вручную, только для бота TG Mirror labels Mar 24, 2024
@Iajret Iajret merged commit 8bd8150 into master Mar 25, 2024
23 checks passed
@Iajret Iajret deleted the upstream-mirror-1601 branch March 25, 2024 20:32
AnywayFarus added a commit that referenced this pull request Mar 25, 2024
Iajret pushed a commit that referenced this pull request May 22, 2024
* Port from downstream

* Re-adds the hair sprite that was removed from the merge conflict

---------

Co-authored-by: GoldenAlpharex <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mirroring conflict git cherry-pick во что-то уткнулся. Не ставить вручную, только для бота TG Mirror
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants