HomePhabricator

[dagit] Lazy import CodeMirror

Description

[dagit] Lazy import CodeMirror

Summary:
Remove CodeMirror from the main vendor bundle by using React.lazy on ExecutionSessionContainer, the only use case of the CodeMirror package in Dagit. ExecutionSessionContainer also becomes its own chunk, which reduces the application bundle as well.

File sizes after gzip:

Before:

  669.66 KB  build/static/js/2.d336297b.chunk.js
  153.37 KB  build/static/js/main.9dc0e9c2.chunk.js
  33.92 KB   build/static/css/2.56579013.chunk.css
  32.28 KB   build/922792c33f2e681c1472.worker.js
  771 B      build/static/js/runtime-main.8b1ec68b.js
  326 B      build/static/css/main.af0c7fcc.chunk.css

After:

  596.68 KB (-72.98 KB)  build/static/js/2.98ac1f77.chunk.js
  143.01 KB (-10.36 KB)  build/static/js/main.0f2746db.chunk.js
  72.93 KB               build/static/js/3.a76ca228.chunk.js
  32.28 KB               build/922792c33f2e681c1472.worker.js
  31.38 KB (-2.54 KB)    build/static/css/2.bc62a557.chunk.css
  14.61 KB               build/static/js/4.cacb1563.chunk.js
  2.93 KB                build/static/css/3.4439d99d.chunk.css
  1.48 KB (+747 B)       build/static/js/runtime-main.efbdbfc2.js
  326 B                  build/static/css/main.af0c7fcc.chunk.css

This isn't anything earth-shattering right now, but as we add more features and complexity, it would be good to have good hygiene and make use some of these cool lazy-loading features to keep bundle size manageable.

Test Plan: Buildkite, sanity check Dagit by navigating to pipeline playground. Verify that everything loads as expected, and that the new bundles are loaded lazily.

Reviewers: bengotow, prha, sashank

Reviewed By: prha

Differential Revision: https://dagster.phacility.com/D6072

Details

Provenance
dishAuthored on Jan 20 2021, 9:52 PM
Reviewer
prha
Differential Revision
D6072: [dagit] Lazy import CodeMirror
Parents
R1:d3832d44cc41: reduce k8s-example image by 104MB (#3501)
Branches
Unknown
Tags
Unknown