-
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
feat: move ace-editor and mathjs to async modules #10837
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10837 +/- ##
==========================================
+ Coverage 59.32% 61.34% +2.02%
==========================================
Files 776 380 -396
Lines 37060 24086 -12974
Branches 3310 0 -3310
==========================================
- Hits 21986 14776 -7210
+ Misses 14891 9310 -5581
+ Partials 183 0 -183
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
a9f4ae0
to
ee48ef6
Compare
cce2701
to
c6aa954
Compare
2582cb9
to
bfc0805
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.
@kristw @etr2460 @graceguo-supercat This is ready for review. Would you mind taking a look?
// height is specified. | ||
(height && ( | ||
<div style={{ width, height }}> | ||
{showLoadingForImport && <Loading position="floating" />} |
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.
output.filename = '[name].[chunkhash].entry.js'; | ||
output.chunkFilename = '[name].[chunkhash].chunk.js'; | ||
} else { | ||
output.filename = '[name].[chunkhash].entry.js'; | ||
output.chunkFilename = '[chunkhash].chunk.js'; |
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.
Don't add names to chunkFiles
(they are just single digit numbers anyway).
'redux', | ||
'react-redux', | ||
'react-hot-loader', | ||
'react-select', | ||
'react-sortable-hoc', | ||
'react-virtualized', | ||
'react-table', | ||
'react-ace', |
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.
react-ace
itself is quite small.
name: 'brace', | ||
test: /\/node_modules\/(brace|react-ace)\//, | ||
priority: 40, | ||
}, |
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.
Different brace
modes/themes now load separately and asynchronously.
maxLines={inModal ? 1000 : this.props.maxLines} | ||
onChange={this.onAceChange.bind(this)} | ||
onChange={this.onAceChangeDebounce} |
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.
Added debounce
to text inputs in Explore view's Datasource editor.
editorProps={{ $blockScrolling: true }} | ||
enableLiveAutocompletion |
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 this prop according to a console warning from Ace.
prefix: string, | ||
callback: (error: null, wordList: object[]) => void, | ||
) => { | ||
if ((session.getMode() as TextMode).$id === `ace/mode/${mode}`) { |
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.
Enable completion for only the related language.
*/ | ||
export default function AsyncAceEditor( | ||
aceModules: AceModule[], | ||
{ defaultMode, defaultTheme, defaultTabSize = 2 }: AsyncAceEditorOptions = {}, |
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.
Set default tabSize
for all AceEditor. Previously there were some places where tabSize
was not set and would default to 4
.
superset-frontend/cypress-base/cypress/integration/explore/control.test.ts
Show resolved
Hide resolved
superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts
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.
LGTM! The cleanup this brings, and the performance improvement, are both appreciated.
Left some general questions & comments you're already addressing, so thanks for that.
const AnnotationLayer = AsyncEsmComponent( | ||
() => import('./AnnotationLayer'), | ||
// size of overlay inner content | ||
() => <div style={{ width: 450, height: 368 }} />, |
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.
Could/should these be based on % values or use a flexbox layout (using the built-in "stretch" features) to avoid hard-coding these dimensions?
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.
The goal here is to make sure the popover renders at the right position so that the left caret always points to the popover trigger when the content of the popover is fully loaded. We wouldn't want the popover to "stretch" since there is no way to update its position after it was re-rendered.
superset-frontend/webpack.config.js
Outdated
'moment', | ||
'jquery', | ||
'core-js.*', | ||
'@emotion.*', | ||
'd3.*', | ||
'd3', | ||
'd3-(array|color|scale||interpolateformat|selection|collection|time|time-format)', |
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.
typo
||interpolateformat
=> |interpolate|format
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.
Wow, just wow... Thanks for spotting this!
Load markdown async Add a test case for markdown edit
Follow up on apache#10831, move brace and mathjs to async modules so that the initial page load for dashboards most pages can be faster.
SUMMARY
Follow up on #10831, move
brace
andmathjs
to async modules so that the initial page load fordashboardsmost pages can be faster.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
On a dashboard page,
brace
loads only after users add a markdown widget to dashboard:Optimized bundle config further helps reduce the overall bundle size:
Initial page load time with production assets and without cache was reduced by 30% (9.8s -> 6.9s in Fast 3G network).
On Explore and CRUD page,
brace
andmathjs
are also loaded on demand.TEST PLAN
Expected behaviors:
brace.js
andmathjs
by default.brace.js
, even when users haven't started editing the markdown.mathjs
automatically.mathjs
will load only for charts that support annotation layers.ADDITIONAL INFORMATION