Sfoglia il codice sorgente

Optimization: Slight performance optimization

陈帅 7 anni fa
parent
commit
2797662f45
3 ha cambiato i file con 20 aggiunte e 11 eliminazioni
  1. 14 6
      config/config.js
  2. 5 2
      src/pages/Dashboard/Analysis.js
  3. 1 3
      src/pages/document.ejs

+ 14 - 6
config/config.js

@@ -21,7 +21,6 @@ export default {
     //   },
     // ],
   ],
-  disableServiceWorker: true,
   locale: {
     enable: true, // default false
     default: 'zh-CN', // default zh-CN
@@ -209,7 +208,6 @@ export default {
   theme: {
     'card-actions-background': '#f5f8fa',
   },
-
   // entry: 'src/index.js', // TODO remove
   extraBabelPlugins: [['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }]],
   env: {
@@ -219,7 +217,6 @@ export default {
   },
   externals: {
     '@antv/data-set': 'DataSet',
-    bizcharts: 'BizCharts',
     rollbar: 'rollbar',
   },
   alias: {
@@ -229,9 +226,6 @@ export default {
     common: path.resolve(__dirname, '../src/common/'),
   },
   ignoreMomentLocale: true,
-  publicPath: '/',
-  // TODO check hash config
-  // hash: true,
   lessLoaderOptions: {
     javascriptEnabled: true,
   },
@@ -253,4 +247,18 @@ export default {
     },
   },
   disableFastClick: true,
+  manifest: {
+    name: 'ant-design-pro',
+    background_color: '#FFF',
+    description: 'An out-of-box UI solution for enterprise applications as a React boilerplate.',
+    display: 'standalone',
+    start_url: '/index.html',
+    icons: [
+      {
+        src: '/favicon.png',
+        sizes: '48x48',
+        type: 'image/png',
+      },
+    ],
+  },
 };

+ 5 - 2
src/pages/Dashboard/Analysis.js

@@ -73,8 +73,10 @@ class Analysis extends Component {
 
   componentDidMount() {
     const { dispatch } = this.props;
-    dispatch({
-      type: 'chart/fetch',
+    this.reqRef = requestAnimationFrame(() => {
+      dispatch({
+        type: 'chart/fetch',
+      });
     });
   }
 
@@ -83,6 +85,7 @@ class Analysis extends Component {
     dispatch({
       type: 'chart/clear',
     });
+    cancelAnimationFrame(this.reqRef);
   }
 
   handleChangeSalesType = e => {

+ 1 - 3
src/pages/document.ejs

@@ -6,11 +6,9 @@
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <title>Ant Design Pro</title>
+  <link rel="manifest" href="/manifest.json">
   <link rel="icon" href="/favicon.png" type="image/x-icon">
   <!-- rollbar -->
-  <script src="https://gw.alipayobjects.com/os/rmsportal/nGVBgVyXzzmbAqevIAPy.js">
-  </script>
-  <!-- bizcharts -->
   <script src=" https://gw.alipayobjects.com/os/rmsportal/TKSqiyoUxzrHoMwjViwA.js "></script>
   <script src="https://gw.alipayobjects.com/os/antv/assets/data-set/0.8.7/data-set.min.js"></script>
 </head>