-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
perf(dashboard): decouple redux props from dashboard components #16421
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16421 +/- ##
==========================================
- Coverage 76.64% 76.54% -0.10%
==========================================
Files 1000 1000
Lines 53489 53494 +5
Branches 6816 6819 +3
==========================================
- Hits 40996 40949 -47
- Misses 12257 12307 +50
- Partials 236 238 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Great work! One small nit/question, other than that LGTM!
@@ -152,7 +152,7 @@ const FilterFocusHighlight = React.forwardRef( | |||
}, | |||
); | |||
|
|||
class ChartHolder extends React.Component { | |||
export class ChartHolder extends React.Component { |
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.
is this export needed somewhere?
@@ -77,7 +78,7 @@ Click here to edit [markdown](https://bit.ly/1dQOfRK)`; | |||
|
|||
const MARKDOWN_ERROR_MESSAGE = t('This markdown component has an error.'); | |||
|
|||
class Markdown extends React.PureComponent { | |||
export class Markdown extends React.PureComponent { |
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.
same here
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.
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.
LGTM!!
* upstream/master: fix: create example DB if needed (apache#16451) fix(native-filters): add handle undefined control value gracefully (apache#16468) Revert "chore: Changes the DatabaseSelector to use the new Select component (apache#16334)" (apache#16478) fix(explore): JS error for creating new metrics from columns (apache#16477) fix: queryEditor bug (apache#16452) docs: make code snippet usable with required imports (apache#16473) perf(dashboard): decouple redux props from dashboard components (apache#16421) perf(dashboard): reduce number of rerenders of Charts (apache#16444)
…he#16421) * perf(dashboard): decouple redux props from dashboard components * Lint fix * Dont make copy of filters object * Remove unnecessary exports
…he#16421) * perf(dashboard): decouple redux props from dashboard components * Lint fix * Dont make copy of filters object * Remove unnecessary exports
SUMMARY
In DashboardComponent (a parent component of dashboard components such as ChartHolder, Tabs, Column etc.) we had a large mapStateToProps function, which maps redux state to props. A lot of those props were used only in some components, but since they were passed to every component, each change triggered a rerender of all components instead of the ones that actually use the changed prop. This PR decouples those props from components that don't need them.
For example -
directPathToChild
is used only byChartHolder
andTabs
, but any change of that prop triggered a rerender of all components on dashboard.This PR is the first of a series of PRs that will come soon - all related to reducing dashboard rerenders.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No changes
TESTING INSTRUCTIONS
Every dashboard functionality should work as it did before
ADDITIONAL INFORMATION
CC @junlincc @jinghua-qa