Commit 64d0f1e2 authored by Tim Zallmann's avatar Tim Zallmann

Fixed text removal memory saving + Fixed collapsed non text files

parent de636f16
...@@ -52,10 +52,16 @@ export default { ...@@ -52,10 +52,16 @@ export default {
handleToggle() { handleToggle() {
const { collapsed, highlightedDiffLines, parallelDiffLines } = this.file; const { collapsed, highlightedDiffLines, parallelDiffLines } = this.file;
if (collapsed && !highlightedDiffLines && !parallelDiffLines.length) { if (
collapsed &&
!highlightedDiffLines &&
parallelDiffLines !== undefined &&
!parallelDiffLines.length
) {
this.handleLoadCollapsedDiff(); this.handleLoadCollapsedDiff();
} else { } else {
this.file.collapsed = !this.file.collapsed; this.file.collapsed = !this.file.collapsed;
this.file.renderIt = true;
} }
}, },
handleLoadCollapsedDiff() { handleLoadCollapsedDiff() {
...@@ -65,6 +71,7 @@ export default { ...@@ -65,6 +71,7 @@ export default {
.then(() => { .then(() => {
this.isLoadingCollapsedDiff = false; this.isLoadingCollapsedDiff = false;
this.file.collapsed = false; this.file.collapsed = false;
this.file.renderIt = true;
}) })
.catch(() => { .catch(() => {
this.isLoadingCollapsedDiff = false; this.isLoadingCollapsedDiff = false;
......
...@@ -31,7 +31,9 @@ export const fetchDiffFiles = ({ state, commit }) => { ...@@ -31,7 +31,9 @@ export const fetchDiffFiles = ({ state, commit }) => {
export const startRenderDiffsQueue = ({ state, commit }) => { export const startRenderDiffsQueue = ({ state, commit }) => {
const checkItem = () => { const checkItem = () => {
const nextFile = state.diffFiles.find(file => !file.renderIt && !file.collapsed); const nextFile = state.diffFiles.find(
file => !file.renderIt && (!file.collapsed || !file.text),
);
if (nextFile) { if (nextFile) {
requestAnimationFrame(() => { requestAnimationFrame(() => {
commit(types.RENDER_FILE, nextFile); commit(types.RENDER_FILE, nextFile);
......
...@@ -21,26 +21,26 @@ export default { ...@@ -21,26 +21,26 @@ export default {
if (file.parallelDiffLines) { if (file.parallelDiffLines) {
file.parallelDiffLines.forEach(line => { file.parallelDiffLines.forEach(line => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
delete line.text; if (line.left) delete line.left.text;
// eslint-disable-next-line no-param-reassign
if (line.right) delete line.right.text;
}); });
} }
if (file.highlightedDiffLines) { if (file.highlightedDiffLines) {
file.highlightedDiffLines.forEach(line => { file.highlightedDiffLines.forEach(line => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
if (line.left) delete line.left.text; delete line.text;
// eslint-disable-next-line no-param-reassign
if (line.right) delete line.right.text;
}); });
} }
if (file.highlightedDiffLines) { if (file.highlightedDiffLines) {
showingLines += file.parallelDiffLines.length; showingLines += file.parallelDiffLines.length;
Object.assign(file, {
renderIt: showingLines < 200,
collapsed: showingLines > 2000,
});
} }
Object.assign(file, {
renderIt: showingLines < 200,
collapsed: file.text && showingLines > 2000,
});
}); });
Object.assign(state, { Object.assign(state, {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment