[release-4.22] OCPBUGS-112290: Flush async feature flag updates immediately - #17075
Conversation
Deferring all setFeatureFlag calls until the next render left flag-gated plugin routes and nav items missing for ~10s after an async console.flag/hookProvider resolved. Keep render-time updates deferred, but dispatch async updates right away. Fixes openshift#16922 Co-authored-by: Cursor <cursoragent@cursor.com>
Update flagsRef when dispatching so consecutive async setFeatureFlag calls (e.g. true then false before Redux re-renders) are not skipped against a stale selector snapshot. Strengthen unit coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
Always dispatch pending setFeatureFlag updates instead of syncing a local FLAGS snapshot. Flags are also set elsewhere and read via useFlag, so a locally mutated copy can go stale. Immutable Map.set is already a no-op when the value is unchanged.
Replace render-phase isRenderingRef tracking with a coalesced queueMicrotask flush so child FeatureFlagExtensionHookResolver re-renders cannot dispatch during render. Drop the stale flagsRef comment and exercise the controller through renderHookWithProviders against a real Redux store.
Unlock after taking the batch so reentrant setFeatureFlag during dispatch can schedule a follow-up microtask. Use createTestPluginStore in tests and cover the reentrant-update path.
createTestPluginStore passed into renderHookWithProviders is enough; sibling console-app tests rely on the same pattern without mocking plugins.
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@redhat-chai-bot: This pull request references Jira Issue OCPBUGS-112290, which is valid. 7 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/verified by unit tests |
|
@logonoff: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff, redhat-chai-bot The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/label tide/merge-method-squash |
|
@redhat-chai-bot: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
6fd62e5
into
openshift:release-4.22
|
@redhat-chai-bot: Jira Issue Verification Checks: Jira Issue OCPBUGS-112290 Jira Issue OCPBUGS-112290 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Cherry-pick of #16949 to release-4.22 with a build fix — inlines
createTestPluginStoreinFeatureFlagExtensionLoader.spec.tsxbecause the original import path (pluginTestUtils) does not exist on the release-4.22 branch.Supersedes #17051 (broken automatic cherry-pick).
AI-generated. Review for accuracy.
@logonoff requested in Slack thread