-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add separate provider for context and pass as children #1410
base: master
Are you sure you want to change the base?
Add separate provider for context and pass as children #1410
Conversation
packages/mco/components/mco-dashboard/disaster-recovery/dr-dashboard.tsx
Outdated
Show resolved
Hide resolved
packages/mco/components/mco-dashboard/disaster-recovery/dr-dashboard.tsx
Outdated
Show resolved
Hide resolved
12b2eec
to
8717610
Compare
plz test the PR properly and attach screenshots... |
8717610
to
653e738
Compare
/lgtm |
/approve cancel |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: TimothyAsirJeyasing The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@SanjalKatiyar is this approved? |
const value = { | ||
activeItemsUID, | ||
setActiveItemsUID, | ||
activeItem, | ||
setActiveItem, | ||
}; |
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.
won't this create a new object after every render? due to this TopologySearchContext.Provider will get new params after every render right?
I still have doubts about this PR, Whether the provider is a separate component does not matter, when the provider props change then It will re-render all of its children. It does not matter whether the child component is a consumer of the provider's property or not. All we can do is pass the parent state to the provider instead of passing the direct value to avoid the request re-rendering. |
^ this is something which can be tested and cross-verified by updating the state continuously and adding a logger in any of the consumer component. |
ack |
LGTM |
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.
@TimothyAsirJeyasing can we test this PR out and see if there is a difference in re-render amounts significantly?
red-hat-storage#672 Signed-off-by: Timothy Asir Jeyasingh <[email protected]>
653e738
to
20e9786
Compare
New changes are detected. LGTM label has been removed. |
In case there is any confusion on why this change was needed (or why GH issue was created), plz check: ^ above was the idea for requesting this change, it's more of a good-practice/correct-way to add context following the pattern shown in the shared sandbox. |
/test odf-console-e2e-aws |
1 similar comment
/test odf-console-e2e-aws |
#672