OCPBUGS-85242: Add Suspense boundary to LazyRoutePage for plugin routes#16409
OCPBUGS-85242: Add Suspense boundary to LazyRoutePage for plugin routes#16409logonoff wants to merge 1 commit intoopenshift:mainfrom
Conversation
|
@logonoff: This pull request references Jira Issue OCPBUGS-85242, which is valid. The bug has been moved to the POST state. 3 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. |
|
@logonoff: This pull request references Jira Issue OCPBUGS-85242, which is valid. 3 validation(s) were run on this bug
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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff 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 |
|
/cherry-pick release-4.22 |
|
@logonoff: once the present PR merges, I will cherry-pick it on top of 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 kubernetes-sigs/prow repository. |
📝 WalkthroughWalkthroughThe 🚥 Pre-merge checks | ✅ 12✅ Passed checks (12 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Wrap lazy-loaded route components in a React.Suspense with a LoadingBox fallback to show a loading state while plugin pages load. Also import Suspense and LoadingBox, and include pluginName in the extension destructuring so the LoadingBox blame includes the plugin and extension uid. This improves UX when route page components are loaded asynchronously.
0aa8fde to
23fc2c8
Compare
|
@logonoff: 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. |
Analysis / Root cause:
LazyRoutePagerendersReact.lazycomponents without its own<Suspense>boundary.It relies on the outer
<Suspense>inapp-contents.tsx, but React Router usesstartTransitionfor navigations.During a transition, React keeps the previous UI visible rather than re-showing a fallback on an already-resolved
<Suspense>boundary — so no loading indicator appears while plugin JS chunks are fetched.Built-in routes don't have this problem because
AsyncComponentwraps each lazy component with its own<Suspense fallback={<LoadingBox />}>.Solution description:
Suspensewrapping the lazy component insideLazyRoutePage.unstable_useTransitionsbehaviour from react-router v6 so that the suspense is shownScreenshots / screen recording:
Test setup:
Load a cluster with a dynamic plugin installed (e.g. OpenShift Pipelines).
Test cases:
Browser conformance:
Summary by CodeRabbit