Skip to content

Commit 16b48c4

Browse files
committed
fix: memory consumption is too high
1 parent 8820750 commit 16b48c4

File tree

4 files changed

+5
-20
lines changed

4 files changed

+5
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"antd": "^3.10.1",
1414
"autoresponsive-react": "^1.1.31",
15+
"deep-eql": "^4.0.0",
1516
"enquire-js": "^0.2.1",
1617
"leancloud-storage": "^3.14.0",
1718
"query-string": "^6.8.2",
@@ -45,7 +46,6 @@
4546
"commander": "~3.0.0",
4647
"concurrently": "^5.0.0",
4748
"cross-env": "^6.0.2",
48-
"deep-eql": "^4.0.0",
4949
"dragula": "^3.7.2",
5050
"eslint": "^6.0.0",
5151
"eslint-config-airbnb": "^17.0.0",

site/edit/template/components/ListComponents/EditorComp.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class EditorComp extends React.Component {
4343
};
4444
newTemplateData.data.style = (newTemplateData.data.style || []).filter(c => c.id !== cb.id);
4545
newTemplateData.data.style.push(data);
46+
console.log(Date.now());
4647
dispatch(actions.setTemplateData(newTemplateData));
4748
}
4849

@@ -83,6 +84,7 @@ class EditorComp extends React.Component {
8384
}
8485

8586
render() {
87+
console.log(Date.now());
8688
const { currentEditData, mediaStateSelect, location } = this.props;
8789
const isCN = isZhCN(location.pathname);
8890
if (!currentEditData) {

site/shared/localStorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const getHistory = () => store.get(LOCAL_STORAGE_HISTORY_KEY, []);
6666
// TODO: why 30?
6767
export const pushToHistory = (data) => {
6868
const history = getHistory();
69-
if (history.length >= 30) {
69+
if (history.length >= 15) {
7070
history.shift();
7171
}
7272
history.push(data);

site/utils.jsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
2+
import deepEql from 'deep-eql';
33
import tempData from './templates/template/element/template.config';
44
import { isZhCN, getLocalizedPathname } from './theme/template/utils';
55

@@ -182,22 +182,6 @@ function getEnumerableKeys(target) {
182182
return keys;
183183
}
184184

185-
function deepEql(a, b) {
186-
if (!a || !b || (Array.isArray(a) && Array.isArray(b))) {
187-
return false;
188-
}
189-
const $a = getEnumerableKeys(a);
190-
const $b = getEnumerableKeys(b);
191-
if ($a.length && $b.length && $a.length === $b.length) {
192-
return !$a.some((key) => {
193-
const aa = a[key];
194-
const bb = b[key];
195-
return aa !== bb;
196-
});
197-
}
198-
return false;
199-
}
200-
201185
export function objectEqual(obj1, obj2) {
202186
if (obj1 === obj2 || deepEql(obj1, obj2)) {
203187
return true;
@@ -258,7 +242,6 @@ export function objectEqual(obj1, obj2) {
258242
setEqualBool(obj2, obj1);
259243
return equalBool;
260244
}
261-
262245
const getParentRect = (item, parentData) => {
263246
const p = [];
264247
let i = 0;

0 commit comments

Comments
 (0)