-
Notifications
You must be signed in to change notification settings - Fork 594
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
Bug 1722876: Fix Infinite Re-Render Bug in Operand List Sort #1863
Bug 1722876: Fix Infinite Re-Render Bug in Operand List Sort #1863
Conversation
@@ -116,7 +116,7 @@ export const navFactory: NavFactory = { | |||
}), | |||
}; | |||
|
|||
export const NavBar: React.SFC<NavBarProps> = ({pages, basePath, hideDivider}) => { | |||
export const NavBar = withRouter<NavBarProps>(({pages, basePath, hideDivider}) => { |
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.
This is actually a better solution to ensure NavBar
re-renders when the route changes. Before it was depending on HorizontalNav
to be re-rendered, but using withRouter
ensures we capture route changes.
NavBar.displayName = 'NavBar'; | ||
|
||
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.
Converted to functional component with useMemo()
to prevent unmounting child <Route>
components.
import ConnectedEmptyStateComponent from '../EmptyState'; | ||
import { getStoreTypedComponent } from '../../test/test-utils'; | ||
|
||
describe('EmptyState', () => { |
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.
Doesn't really test anything, and fails when upgrading to newer react-redux
version.
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.
Nice catch 👍
Operand
is a much better name as well.
/lgtm
@alecmerdler: This pull request references a valid Bugzilla bug. The bug has been moved to the POST state. In 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/test-infra repository. |
f7804b6
to
14a3d84
Compare
14a3d84
to
54aedcd
Compare
/lgtm |
Looks like integration test login is broken with this change |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
/hold ...to prevent automatic retesting. The login tests are consistently failing. |
54aedcd
to
6981ce6
Compare
@@ -24,12 +24,6 @@ import { | |||
PageSectionVariants, | |||
} from '@patternfly/react-core'; | |||
|
|||
// React Router's proptypes are incorrect. See https://github.com/ReactTraining/react-router/pull/5393 | |||
(Route as any).propTypes.path = PropTypes.oneOfType([ |
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.
This was causing problems with yarn run build
. Issue appears to be fixed with newer version of library.
/hold cancel |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alecmerdler, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
We got past login this time /retest |
Tests are passing locally for me, so they must be CI flakes. |
Description
Use
React.memo()
andReact.useCallback()
to preventHorizontalNav
from re-rendering unnecessarily, which causes the detail page route components to be mounted/unmounted when usingprops.pagesFor()
.Upgrade
react-redux
to work withReact.memo()
Upgrade
react-router
,react-router-dom
so that they work withReact.memo()
Upgrade
react-helmet
because of another call stack issue.Also renames components, types, and other symbols from using
ClusterServiceVersionResource
toOperand
.Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1722876