Remove 'context' parameter from TGUIs #12172
Merged
+1,998
−2,078
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.
About The Pull Request
Ports tgstation/tgstation#80003
For maintainers, the best way to review this is to just check the first commit on this PR for the actual technical changes. Everything else is just automatic regex.
Regex For Downstreams
I wrote these myself. They "just work". Don't question it.
In folder:
tgui/packages/tgui/interfaces/**
REPLACE:
useBackend(<\w+>)?\(([\n ]*?)?(this\.)?context\s?\)
WITH:
useBackend$1()
REPLACE:
use(Local|Shared)State(<[\S\s]+>)?\(([\n ]*?)?(this\.)?context,? ?
WITH:
use$1State$2(
REPLACE:
\(([\n ]*?)?((\w+|\{([\S\s]+\}))(: (\w+|\{([\S\s]+\})))?),([\n ]*?)?_?context(: (\w+|\{([\S\s]+\})))?([\n ]*?)?\)
WITH:
($2)
How to use
Why It's Good For The Game
This is a precursor for React. The 'context' parameter isn't used in modern React. There's no need to pass it around a bunch.
Testing Photographs and Procedure
Screenshots&Videos
TGUIs work.
Changelog
🆑 itsmeow, jlsnow301
code: Removed 'context' parameter from TGUIs. This is an internal change that should not affect anything.
/:cl: