-
Notifications
You must be signed in to change notification settings - Fork 69
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] Fix some Section jank disallowing stamps from working properly and messengers from auto-scrolling #1951
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ly and messengers from auto-scrolling (#923) * Fix some Section jank disallowing stamps from working properly and messengers from auto-scrolling (#81418) ## About The Pull Request ### Alternate title: "A spark of madness drove me to want to fix paperwork tgui" While doing paperwork I noticed that stamps could not be placed below a certain point on paperwork, just reverting to being higher up. Actually testing this, it seemed the stamps were not accounting for scroll offset in some way. <details> <summary>Images of Stamping Issue</summary> ![image](https://github.com/tgstation/tgstation/assets/42909981/96dbdafa-b7fc-44ed-8a93-2d0d9bfd51dc) ![image](https://github.com/tgstation/tgstation/assets/42909981/7193585a-511a-41b5-a3a0-8670ed692c14) </details> This led me to look into the code, and lo and behold, when `PaperSheetStamper` in `interfaces/PaperSheet.tsx` was trying to get the scroll offset from its `scrollableRef` it was simply returning 0 for `scrollTop` and 469 for `height` regardless of what either value should be. I presumed _something_ was causing the reference to not be properly forwarded from `PreviewView`'s `Section` to `PaperSheetStamper`, and continued by testing `onScrollHandler`. `onScrollHandler` seemed to actually have the desired values, and so I made my first naive fix: having `PrimaryView` instead handle taking the values from `onScrollHandler` and forwarding them to `PaperSheetStamper`, and this worked fine! However, I felt I didn't understand enough about _why_ the reference method didn't work to commit to this approach. So I went to look deeper, and found that there's actually at least one more thing suffering from this issue. `interfaces/NtosMessenger/ChatScreen.tsx`, the PDA messenger. Specifically, its `scrollToBottom` method was using a `Section` reference similarly to our problematic `interfaces/PaperSheet.tsx`, and wasn't actually working. <details> <summary>Images of PDA Issue</summary> ![image](https://github.com/tgstation/tgstation/assets/42909981/354c3ee5-15e2-4ffb-95eb-b4d33f58701a) </details> With tens of tabs of React documentation and tg files open went through a crash course in React references, and hey uh- wait, no, hold on. It can't be. Right? `components/Section.tsx` was handling two distinct references, `forwardedRef` and `contentRef`, in two distinct places. The former, at the highest `div`, the latter at a lower `div`... together with `onScroll`, seemingly confirming my suspicions. Looking through the file's history, it seems that over the last several prs and reimplementations of parts of this file, the `div` it was forwarding a reference from was moved from being the same as `onScroll` to a different `div` altogether. Then, this became `contentRef`. And to confirm this, merging `forwardedRef` and `contentRef` seemed to fix the issues with both stamping paperwork and PDA auto-scrolling just fine. <details> <summary>Images of PDA Issues Resolved</summary> ![image](https://github.com/tgstation/tgstation/assets/42909981/aaa6ccac-3271-4056-9761-a0a38ac72a4b) ![image](https://github.com/tgstation/tgstation/assets/42909981/1f03f627-8a75-4df2-89c2-757ff9fdbd42) </details> <details> <summary>Images of Stamping Issues Resolved</summary> ![image](https://github.com/tgstation/tgstation/assets/42909981/a4e36095-ec6b-4109-aeee-17cf9ced6ef3) ![image](https://github.com/tgstation/tgstation/assets/42909981/ca4eb62b-c7ed-4420-b869-58970da6a9f9) ![image](https://github.com/tgstation/tgstation/assets/42909981/bf1309ec-3a8b-4aa5-baed-b45a8ccfc577) </details> Final notes: - I recognized the issue at play in a moment of madness at 1am, it however still took an extra day for me to feel confident enough in my React to actually fix this without crashing everything else ever. - Coincidentally "Ace Combat Zero Soundtrack - Zero" was playing in the background while finalizing this. - For some esoteric reason beyond my current comprehension, as opposed to non-stamped paperwork, stamped paperwork does not auto-focus when scrolled over sometimes. As it already did this before my changes, I am considering it outside of the scope of this pr. It would also most likely deal 3d8 psychic damage, on top of it being 1:53am as of writing this. ## Why It's Good For The Game Reduces paperwork jank, but broadly fixes issues with Section's forwarded reference not actually being a reference to the scrolling part. This includes PDA messengers' scroll to bottom actually working. Fixes #60508. Given the issue is from 2021 I don't think it's _related_, but it exists again and hey it works fine now! Fixes PDA messengers' scroll to bottom actually working. Fixes, uh, probably other stuff that used to rely on this working. ## Changelog :cl: fix: Fixed stamps not accounting for scroll offset. You can actually stamp paperwork properly without using accursed knowledge again. fix: Fixed PDA messenger not scrolling to the bottom when a new message gets sent. /:cl: * Fix some Section jank disallowing stamps from working properly and messengers from auto-scrolling --------- Co-authored-by: _0Steven <[email protected]>
AnywayFarus
added a commit
that referenced
this pull request
Feb 13, 2024
Iajret
pushed a commit
that referenced
this pull request
Apr 12, 2024
…& adds blackbox logging for spells, runes, and shades (#1951) * Blood cult: cleans up blood rites code, fixes a bug or two, & adds blackbox logging for spells, runes, and shades (#82444) * Blood cult: cleans up blood rites code, fixes a bug or two, & adds blackbox logging for spells, runes, and shades --------- Co-authored-by: wesoda25 <[email protected]>
ReezeBL
pushed a commit
that referenced
this pull request
Apr 13, 2024
…& adds blackbox logging for spells, runes, and shades (#1951) (#2856) * Blood cult: cleans up blood rites code, fixes a bug or two, & adds blackbox logging for spells, runes, and shades (#82444) * Blood cult: cleans up blood rites code, fixes a bug or two, & adds blackbox logging for spells, runes, and shades --------- Co-authored-by: NovaBot <[email protected]> Co-authored-by: wesoda25 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mirrored on Nova: NovaSector/NovaSector#923
Original PR: tgstation/tgstation#81418
About The Pull Request
Alternate title: "A spark of madness drove me to want to fix paperwork tgui"
While doing paperwork I noticed that stamps could not be placed below a certain point on paperwork, just reverting to being higher up. Actually testing this, it seemed the stamps were not accounting for scroll offset in some way.
Images of Stamping Issue
This led me to look into the code, and lo and behold, when
PaperSheetStamper
ininterfaces/PaperSheet.tsx
was trying to get the scroll offset from itsscrollableRef
it was simply returning 0 forscrollTop
and 469 forheight
regardless of what either value should be.I presumed something was causing the reference to not be properly forwarded from
PreviewView
'sSection
toPaperSheetStamper
, and continued by testingonScrollHandler
.onScrollHandler
seemed to actually have the desired values, and so I made my first naive fix: havingPrimaryView
instead handle taking the values fromonScrollHandler
and forwarding them toPaperSheetStamper
, and this worked fine!However, I felt I didn't understand enough about why the reference method didn't work to commit to this approach.
So I went to look deeper, and found that there's actually at least one more thing suffering from this issue.
interfaces/NtosMessenger/ChatScreen.tsx
, the PDA messenger.Specifically, its
scrollToBottom
method was using aSection
reference similarly to our problematicinterfaces/PaperSheet.tsx
, and wasn't actually working.Images of PDA Issue
components/Section.tsx
was handling two distinct references,forwardedRef
andcontentRef
, in two distinct places. The former, at the highestdiv
, the latter at a lowerdiv
... together withonScroll
, seemingly confirming my suspicions.Looking through the file's history, it seems that over the last several prs and reimplementations of parts of this file, the
div
it was forwarding a reference from was moved from being the same asonScroll
to a differentdiv
altogether. Then, this becamecontentRef
.And to confirm this, merging
forwardedRef
andcontentRef
seemed to fix the issues with both stamping paperwork and PDA auto-scrolling just fine.Images of PDA Issues Resolved
Images of Stamping Issues Resolved
Final notes:
Why It's Good For The Game
Reduces paperwork jank, but broadly fixes issues with Section's forwarded reference not actually being a reference to the scrolling part. This includes PDA messengers' scroll to bottom actually working.
Fixes #60508. Given the issue is from 2021 I don't think it's related, but it exists again and hey it works fine now!
Fixes PDA messengers' scroll to bottom actually working.
Fixes, uh, probably other stuff that used to rely on this working.
Changelog
🆑 00-Steven
fix: Fixed stamps not accounting for scroll offset. You can actually stamp paperwork properly without using accursed knowledge again.
fix: Fixed PDA messenger not scrolling to the bottom when a new message gets sent.
/:cl: