fix: gate asset polling on unified assets flag without violating hooks#30381
Conversation
Mount polling hooks only when unified assets state is enabled, using a split provider so hook order stays stable. Update tests to mock selectors and cover the disabled path.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #30381 +/- ##
==========================================
- Coverage 82.02% 82.02% -0.01%
==========================================
Files 5451 5451
Lines 145587 145595 +8
Branches 33322 33323 +1
==========================================
+ Hits 119422 119425 +3
- Misses 18005 18010 +5
Partials 8160 8160 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Key impact areas:
The change is a refactor with a feature flag guard - relatively low risk since existing behavior is preserved when the flag is enabled. However, the flag-gating logic is new and could introduce regressions if the flag state is not correctly read or if the conditional rendering causes hook ordering issues (React rules of hooks). The test file confirms the new behavior is tested at unit level, but E2E validation is warranted for the affected user flows. Performance Test Selection: |
|



Mount polling hooks only when unified assets state is enabled, using a split provider so hook order stays stable. Update tests to mock selectors and cover the disabled path.
Description
Changelog
CHANGELOG entry: gate asset polling on unified assets flag without violating hooks
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Changes when asset polling hooks are mounted based on a feature flag, which can affect token/rate refresh behavior if the flag value or selector wiring is incorrect. Scope is contained to the polling provider and its unit tests.
Overview
Gates asset polling behind the unified assets feature flag.
AssetPollingProvidernow checksselectIsAssetsUnifyStateEnabledand returnsnullwhen disabled.To avoid conditional hook invocation, polling hooks were moved into a separate
AssetPollingEnabledContentcomponent that only renders when the flag is enabled. Tests were updated to mock the new selector and to assert hooks are not mounted when the flag is off, while keeping existing parameter assertions when enabled.Reviewed by Cursor Bugbot for commit 32fe461. Bugbot is set up for automated code reviews on this repo. Configure here.