Skip to content
代码片段 群组 项目
未验证 提交 3baefdd2 编辑于 作者: Phil Hughes's avatar Phil Hughes
浏览文件

Fixes collapsed state loading not working with virtual scroller

上级 ad1dbf5b
No related branches found
No related tags found
无相关合并请求
......@@ -83,6 +83,7 @@ export default {
idState() {
return {
isLoadingCollapsedDiff: false,
hasLoadedCollapsedDiff: false,
forkMessageVisible: false,
hasToggled: false,
};
......@@ -181,7 +182,13 @@ export default {
},
'file.file_hash': {
handler: function hashChangeWatch(newHash, oldHash) {
if (newHash && oldHash && !this.hasDiff && !this.preRender) {
if (
newHash &&
oldHash &&
!this.hasDiff &&
!this.preRender &&
!this.idState.hasLoadedCollapsedDiff
) {
this.requestDiff();
}
},
......@@ -265,14 +272,22 @@ export default {
}
},
requestDiff() {
this.idState.isLoadingCollapsedDiff = true;
const { idState, file } = this;
this.loadCollapsedDiff(this.file)
idState.isLoadingCollapsedDiff = true;
this.loadCollapsedDiff(file)
.then(() => {
this.idState.isLoadingCollapsedDiff = false;
this.setRenderIt(this.file);
idState.isLoadingCollapsedDiff = false;
idState.hasLoadedCollapsedDiff = true;
if (this.file.file_hash === file.file_hash) {
this.setRenderIt(this.file);
}
})
.then(() => {
if (this.file.file_hash !== file.file_hash) return;
requestIdleCallback(
() => {
this.postRender();
......@@ -282,7 +297,7 @@ export default {
);
})
.catch(() => {
this.idState.isLoadingCollapsedDiff = false;
idState.isLoadingCollapsedDiff = false;
createFlash({
message: this.$options.i18n.genericError,
});
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册