-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Re-Rendering Caused by API Discovery #603
Fix Re-Rendering Caused by API Discovery #603
Conversation
This seems to make things much better, but I'm still seeing some flicker. I wish we better understood why the websocket keeps closing:
|
@spadgett When writing the
This may be a problem with Kubernetes API server code in general. Regardless, this fix will work for non-admin users who have to use polling instead of listing |
I'm seeing some other errors with this change:
|
2df679f
to
993bd2d
Compare
a5702bc
to
2664136
Compare
@@ -281,16 +281,20 @@ class NamespaceDropdown_ extends React.Component { | |||
|
|||
const NamespaceDropdown = connect(namespaceDropdownStateToProps)(NamespaceDropdown_); | |||
|
|||
const NamespaceSelector_ = ({useProjects, inFlight}) => inFlight | |||
const NamespaceSelector_ = ({useProjects, inFlight, loaded}) => inFlight && !loaded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to prevent this component from re-rendering.
@@ -94,14 +103,25 @@ export const NavBar = ({pages, basePath}) => { | |||
}; | |||
NavBar.displayName = 'NavBar'; | |||
|
|||
/** @augments {React.PureComponent<{className?: string, label?: string, pages: {href: string, name: string, component: React.ComponentType}[], match: any, resourceKeys?: string[]}>} */ | |||
export class HorizontalNav extends React.PureComponent { | |||
export class HorizontalNav extends React.PureComponent<HorizontalNavProps> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes here other than converting to TypeScript.
k8sModels: resources.reduce((models, {kind}) => models.set(kind, k8s.getIn(['RESOURCES', 'models', kind])), ImmutableMap()), | ||
loaded: reduxIDs.every(id => k8s.getIn([id, 'loaded'])), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spadgett So this solution prevents the entire view from being re-rendered, but something is causing Firehose
to be unmounted when RESOURCES.inFlight
changes, which causes the WebSockets to be briefly terminated. However, the re-rendering only affects the list rows now and is pretty fast.
2664136
to
341d26f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @alecmerdler. This is a huge improvement 👍
We can investigate Firehose getting unmounted separately.
/lgtm
/hold |
Holding to make sure our CI runs |
341d26f
to
a4029fe
Compare
e8cf603
to
18578c9
Compare
builder-run.sh
Outdated
@@ -30,5 +30,6 @@ docker run $ENV_STR --rm --net=host \ | |||
--user="${BUILDER_RUN_USER}" \ | |||
$VOLUME_MOUNT \ | |||
-v "$(pwd)":/go/src/github.com/openshift/console \ | |||
--shm-size=256m \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used this suggestion to fix the WebDriver error.
74093b7
to
59c5187
Compare
c8e0fa3
to
cb24649
Compare
… are loaded when API discovery runs
cb24649
to
5b87b63
Compare
@@ -82,13 +82,15 @@ describe('Performance test', () => { | |||
}; | |||
|
|||
it(`downloads new bundle for ${routeName}`, async() => { | |||
await browser.get(`${appHost}/status/all-namespaces`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this fixes the weird "Performance" e2e test failure.
👍 /lgtm |
Description
Refactor
Firehose
component to simplify complex/hacky React lifecyle logic. Ensure thatFirehose
does not re-render when API discovery runs if its own data is loaded.Testing
Open a terminal alongside the browser window and create a CRD:
The list/detail view should not be affected.
Addresses https://jira.coreos.com/browse/CONSOLE-812