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 {
handleToggle() {
const { collapsed, highlightedDiffLines, parallelDiffLines } = this.file;
if (collapsed && !highlightedDiffLines && !parallelDiffLines.length) {
if (
collapsed &&
!highlightedDiffLines &&
parallelDiffLines !== undefined &&
!parallelDiffLines.length
) {
this.handleLoadCollapsedDiff();
} else {
this.file.collapsed = !this.file.collapsed;
this.file.renderIt = true;
}
},
handleLoadCollapsedDiff() {
......@@ -65,6 +71,7 @@ export default {
.then(() => {
this.isLoadingCollapsedDiff = false;
this.file.collapsed = false;
this.file.renderIt = true;
})
.catch(() => {
this.isLoadingCollapsedDiff = false;
......
......@@ -31,7 +31,9 @@ export const fetchDiffFiles = ({ state, commit }) => {
export const startRenderDiffsQueue = ({ state, commit }) => {
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) {
requestAnimationFrame(() => {
commit(types.RENDER_FILE, nextFile);
......
......@@ -21,26 +21,26 @@ export default {
if (file.parallelDiffLines) {
file.parallelDiffLines.forEach(line => {
// 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) {
file.highlightedDiffLines.forEach(line => {
// eslint-disable-next-line no-param-reassign
if (line.left) delete line.left.text;
// eslint-disable-next-line no-param-reassign
if (line.right) delete line.right.text;
delete line.text;
});
}
if (file.highlightedDiffLines) {
showingLines += file.parallelDiffLines.length;
}
Object.assign(file, {
renderIt: showingLines < 200,
collapsed: showingLines > 2000,
collapsed: file.text && showingLines > 2000,
});
}
});
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