Conversation
d20f949
to
82b3f76
Compare
Deploy preview for superset-ui-plugins ready! Built with commit 2c903f3 |
e0ad5ef
to
1c1f41d
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.
Some notes.
packages/superset-ui-plugins-demo/storybook/stories/legacy-plugin-chart-table/Stories.tsx
Show resolved
Hide resolved
This commit tries to optimize the performance of the legacy data table. 1. Converting everything to Typescript. 2. Create a native React component instead of `reactify` (although all DOM operaions still happen in the jQuery.DataTables plugin. 3. Remove dependency on d3, optimize how bars are rendered. Plus some minor changes to fix linting and building. Also added a script to build only specific plugin for faster development.
1c1f41d
to
a37bd8c
Compare
Unfortunately jquery.datatables uses innerHTML to create cell content, and all rows are created even with pagination. https://github.com/DataTables/DataTables/blob/83657a29e33ce93ee940ce25684940eb3acb2913/media/js/jquery.dataTables.js#L3113-L3117 This is slow and insecure. We are reverting to DOM data source as in previous implementation, but instead of using D3 to create the table rows, we use React. This also renders `dompurify.sanitize` unnecessary since React will take care of it.
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.
Removed dependency on
dompurify
. Now that HTML tags will be rendered as plain text (by React) instead of innerHTML.
There are columns values that are html strings, such as html links. You would need dangerouslySetInnerHTML
and dompurify
or use interweave
.
packages/superset-ui-legacy-plugin-chart-table/src/ReactDataTable.tsx
Outdated
Show resolved
Hide resolved
packages/superset-ui-legacy-plugin-chart-table/src/ReactDataTable.tsx
Outdated
Show resolved
Hide resolved
Also 1. improve height adjustment 2. add page size control to storybook 3. hide rows from later pages at initial rendering
packages/superset-ui-legacy-plugin-chart-table/src/ReactDataTable.tsx
Outdated
Show resolved
Hide resolved
packages/superset-ui-legacy-plugin-chart-table/src/ReactDataTable.tsx
Outdated
Show resolved
Hide resolved
The build seems to be broken on |
Plus minor variable name and comment update
b642b14
to
3ec8414
Compare
Codecov Report
@@ Coverage Diff @@
## master #385 +/- ##
=========================================
+ Coverage 1.47% 1.48% +<.01%
=========================================
Files 186 185 -1
Lines 5824 5805 -19
Branches 342 370 +28
=========================================
Hits 86 86
+ Misses 5726 5707 -19
Partials 12 12
Continue to review full report at Codecov.
|
packages/superset-ui-legacy-plugin-chart-table/src/ReactDataTable.tsx
Outdated
Show resolved
Hide resolved
packages/superset-ui-legacy-plugin-chart-table/src/ReactDataTable.tsx
Outdated
Show resolved
Hide resolved
packages/superset-ui-legacy-plugin-chart-table/src/ReactDataTable.tsx
Outdated
Show resolved
Hide resolved
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.
just a few nits
Upgrade table chart `@superset-ui/legacy-plugins-chart-table` to apache-superset/superset-ui-plugins#385
* perf(table-chart): upgrade to 0.11.6 Upgrade table chart `@superset-ui/legacy-plugins-chart-table` to apache-superset/superset-ui-plugins#385 * refactor: use ternary instead of if * fix: rename variables
* feat: faster legacy table chart This commit tries to optimize the performance of the legacy data table. 1. Converting everything to Typescript. 2. Create a native React component instead of `reactify` (although all DOM operaions still happen in the jQuery.DataTables plugin. 3. Remove dependency on d3, optimize how bars are rendered. Plus some minor changes to fix linting and building. Also added a script to build only specific plugin for faster development. * feat(legacy-table-chart): use React to render DOM Unfortunately jquery.datatables uses innerHTML to create cell content, and all rows are created even with pagination. https://github.com/DataTables/DataTables/blob/83657a29e33ce93ee940ce25684940eb3acb2913/media/js/jquery.dataTables.js#L3113-L3117 This is slow and insecure. We are reverting to DOM data source as in previous implementation, but instead of using D3 to create the table rows, we use React. This also renders `dompurify.sanitize` unnecessary since React will take care of it. * feat(legacy-table-chart): support html in data cells Also 1. improve height adjustment 2. add page size control to storybook 3. hide rows from later pages at initial rendering * fix(legacy-data-table): minor formatting fixes * chore(legacy-table): add xss dependency Plus minor variable name and comment update * fix(legacy-table): linting errors * refactor(legacy-table): more predictable metric labels * feat(legacy-table): also display title for percent metric * fix(legacy-table): typos, var names, etc * docs: update notes for metric.label * refactor(legacy-table): upgrade number-format * fix(legacy-table): upgrade dependency for storybook and yarn
* feat: faster legacy table chart This commit tries to optimize the performance of the legacy data table. 1. Converting everything to Typescript. 2. Create a native React component instead of `reactify` (although all DOM operaions still happen in the jQuery.DataTables plugin. 3. Remove dependency on d3, optimize how bars are rendered. Plus some minor changes to fix linting and building. Also added a script to build only specific plugin for faster development. * feat(legacy-table-chart): use React to render DOM Unfortunately jquery.datatables uses innerHTML to create cell content, and all rows are created even with pagination. https://github.com/DataTables/DataTables/blob/83657a29e33ce93ee940ce25684940eb3acb2913/media/js/jquery.dataTables.js#L3113-L3117 This is slow and insecure. We are reverting to DOM data source as in previous implementation, but instead of using D3 to create the table rows, we use React. This also renders `dompurify.sanitize` unnecessary since React will take care of it. * feat(legacy-table-chart): support html in data cells Also 1. improve height adjustment 2. add page size control to storybook 3. hide rows from later pages at initial rendering * fix(legacy-data-table): minor formatting fixes * chore(legacy-table): add xss dependency Plus minor variable name and comment update * fix(legacy-table): linting errors * refactor(legacy-table): more predictable metric labels * feat(legacy-table): also display title for percent metric * fix(legacy-table): typos, var names, etc * docs: update notes for metric.label * refactor(legacy-table): upgrade number-format * fix(legacy-table): upgrade dependency for storybook and yarn
This commit tries to optimize the performance of the legacy data table.
d3
andreactify
, we create the DOM with React itself and initializejquery.DataTables
with auseEffect
hook.dompurify
. Now that HTML tags will be rendered as plain text (by React) instead ofinnerHTML
.Plus some minor changes to fix linting and building.
Related: apache/superset#9234
Screenshots
Tested with a ~10,000 rows, 7 columns table in Superset, pagination enabled:
Before
Takes about 6 secs to load.
After
Takes only 3 secs to load!
馃弳 Enhancements