[No QA] ai-reviewer: keep state and subscriptions narrow#81510
[No QA] ai-reviewer: keep state and subscriptions narrow#81510mountiny merged 1 commit intoExpensify:mainfrom
Conversation
Define pattern to avoid bundling unrelated state in contexts/hooks/stores, reducing unnecessary re-renders and improving performance predictability.
|
@adhorodyski Anything for me to test here? |
|
@jjcoffee no, just more docs for LLMs to replace us at our jobs! |
|
For context, this is pretty much a very robust version of eg PERF-11 but that's intentional on my end and I discussed this for long time with Claude. The PERF rule is easy to execute but has very little context when compared to this architectural one. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
mountiny
left a comment
There was a problem hiding this comment.
Looks great, thank you! My comment is nab so I will go ahead and merge this
|
|
||
| **Distinction from PERF-11**: PERF-11 addresses individual `useOnyx` selector usage. This rule addresses state structure — how multiple values are grouped and exposed to consumers via contexts, hooks, or stores. | ||
|
|
||
| **Distinction from CLEAN-REACT-PATTERNS-2**: PATTERNS-2 addresses data flow direction — parent shouldn't fetch data just to pass to children. This rule addresses how state is structured and grouped within any state provider. |
There was a problem hiding this comment.
NAB: Do you want to add similar comment to the CLEAN-REACT-PATTERNS-2 so the ai can get the context on distinction already there?
There was a problem hiding this comment.
I think we can address these small notes once all rules from the predesign are in place.
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@kacper-mikolajczak @tgolen @roryabraham @mountiny
Explanation of Change
This PR adds in a new AI reviewer rule,
[CLEAN-REACT-PATTERNS-5] Keep state and subscriptions narrowas per the predesign wrapped here.Slack thread with the original rule: https://expensify.slack.com/archives/C05LX9D6E07/p1766430842601989?thread_ts=1765986521.968779&cid=C05LX9D6E07
Fixed Issues
$ #74367
PROPOSAL: https://expensify.slack.com/archives/C05LX9D6E07/p1766430842601989?thread_ts=1765986521.968779&cid=C05LX9D6E07
Tests
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari