-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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): Improve perf of highlighting charts in scope of active filter #15424
Conversation
a6f9129
to
e98d859
Compare
Codecov Report
@@ Coverage Diff @@
## master #15424 +/- ##
==========================================
+ Coverage 76.99% 77.01% +0.01%
==========================================
Files 975 974 -1
Lines 50634 50705 +71
Branches 6222 6238 +16
==========================================
+ Hits 38988 39052 +64
- Misses 11435 11440 +5
- Partials 211 213 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
selectIndicatorsForChart(chartId, dashboardFilters, datasources, chart), | ||
[ | ||
chartId, | ||
JSON.stringify(chart), |
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.
Interesting dependency trick! Do we need to suppress linter warnings here?
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.
It turned out that it wasn't necessary here, but we do use that trick throughout our codebase. ESLint complains about that, but I think that we can live with that if we must use complex objects in the dependency array
dashboardLayout: Layout, | ||
chartConfiguration: ChartConfiguration = {}, | ||
): Indicator[] => { | ||
const chart = charts[chartId]; | ||
// no indicators before chart is rendered | ||
if (chart.chartStatus !== 'rendered') return []; |
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 logic should probably be in a render function rather than in a selector
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.
👍
#15420 could you also resolve that issue ? |
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.
Awesome! The original work on this feature was kind of rushed so I'm really glad you were able to get these optimizations done!
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 minor problem noticed, other than that LGTM!
superset-frontend/src/dashboard/components/FiltersBadge/selectors.ts
Outdated
Show resolved
Hide resolved
Thanks for reporting that! I'll tackle it in a separate PR as it seems to be out of scope of this one |
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 👍
…ve filter (apache#15424) * perf(dashboard): Improve perf of highlighting charts in scope of active filter * More optimizations * fix tests * Fix lint * bug fix
…ve filter (apache#15424) * perf(dashboard): Improve perf of highlighting charts in scope of active filter * More optimizations * fix tests * Fix lint * bug fix
…ve filter (apache#15424) * perf(dashboard): Improve perf of highlighting charts in scope of active filter * More optimizations * fix tests * Fix lint * bug fix
SUMMARY
Due to passing as a prop
nativeFilters
object (from redux), which changes on each focus/unfocus of native filters, fromDashboardComponent
, all dashboard components (tabs, rows, chart holders, dividers...) were being rerendered on each native filter focus. This PR optimizes that behaviour by passingnativeFilters
only toTabs
component.Also, I optimized rendering
FiltersBadge
component - due to passing complex objects as props, expensive calculations were being re-run multiple times.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
DASHBOARD_NATIVE_FILTERS
feature flagFilterFocusHighlight
component gets rerendered).ADDITIONAL INFORMATION
CC: @graceguo-supercat @villebro @junlincc