perf: defer styles computation from module import to provider render#87617
perf: defer styles computation from module import to provider render#87617elirangoshen wants to merge 4 commits intoExpensify:mainfrom
Conversation
Remove eagerly-computed defaultStyles and DefaultStyleUtils that ran the entire 6500-line styles() function at module import time. The context defaults are never used at runtime since useThemeStyles() and useStyleUtils() both throw on null context. This defers styles computation to ThemeStylesProvider render, improving web startup by ~336ms (9.6%). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
Use @src/styles and @src/styles/theme paths instead of restricted @styles/index and @styles/theme paths, eliminating all eslint-disable comments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests render components without ThemeStylesProvider, so the context defaults must be real values. Use a Proxy with lazy initialization to defer the expensive styles(defaultTheme) call to first property access, preserving the startup perf gain while keeping tests working. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
Use @src/styles paths instead of restricted @Styles paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Can be closed it's already merged #88097 |
Remove eagerly-computed defaultStyles and DefaultStyleUtils that ran the entire 6500-line styles() function at module import time. The context defaults are never used at runtime since useThemeStyles() and useStyleUtils() both throw on null context. This defers styles computation to ThemeStylesProvider render, improving web startup by ~336ms (9.6%).
Explanation of Change
Fixed Issues
$
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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