improve performance with BoardViewModel
This commit is contained in:
Vendored
+2
-1
@@ -1687,6 +1687,7 @@
|
|||||||
};
|
};
|
||||||
close = () => {
|
close = () => {
|
||||||
this.taskPageViewModel.closeBoard();
|
this.taskPageViewModel.closeBoard();
|
||||||
|
this.taskViewModels.clear();
|
||||||
};
|
};
|
||||||
showSettings = () => {
|
showSettings = () => {
|
||||||
this.isPresentingSettingsModal.value = true;
|
this.isPresentingSettingsModal.value = true;
|
||||||
@@ -1723,11 +1724,11 @@
|
|||||||
this.color.value = this.boardInfo.color;
|
this.color.value = this.boardInfo.color;
|
||||||
};
|
};
|
||||||
loadTasks = () => {
|
loadTasks = () => {
|
||||||
this.taskViewModels.clear();
|
|
||||||
const taskIds = this.boardModel.listTaskIds(
|
const taskIds = this.boardModel.listTaskIds(
|
||||||
this.boardInfo.fileId
|
this.boardInfo.fileId
|
||||||
);
|
);
|
||||||
for (const taskId of taskIds) {
|
for (const taskId of taskIds) {
|
||||||
|
if (this.taskViewModels.value.has(taskId)) return;
|
||||||
const taskFileContent = this.boardModel.getLatestTaskFileContent(taskId);
|
const taskFileContent = this.boardModel.getLatestTaskFileContent(taskId);
|
||||||
if (taskFileContent == null) continue;
|
if (taskFileContent == null) continue;
|
||||||
const taskViewModel = new TaskViewModel(
|
const taskViewModel = new TaskViewModel(
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ export default class BoardViewModel {
|
|||||||
|
|
||||||
close = (): void => {
|
close = (): void => {
|
||||||
this.taskPageViewModel.closeBoard();
|
this.taskPageViewModel.closeBoard();
|
||||||
|
this.taskViewModels.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
showSettings = (): void => {
|
showSettings = (): void => {
|
||||||
@@ -168,12 +169,12 @@ export default class BoardViewModel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
loadTasks = (): void => {
|
loadTasks = (): void => {
|
||||||
this.taskViewModels.clear();
|
|
||||||
|
|
||||||
const taskIds: string[] = this.boardModel.listTaskIds(
|
const taskIds: string[] = this.boardModel.listTaskIds(
|
||||||
this.boardInfo.fileId
|
this.boardInfo.fileId
|
||||||
);
|
);
|
||||||
for (const taskId of taskIds) {
|
for (const taskId of taskIds) {
|
||||||
|
if (this.taskViewModels.value.has(taskId)) return;
|
||||||
|
|
||||||
const taskFileContent: TaskFileContent | null =
|
const taskFileContent: TaskFileContent | null =
|
||||||
this.boardModel.getLatestTaskFileContent(taskId);
|
this.boardModel.getLatestTaskFileContent(taskId);
|
||||||
if (taskFileContent == null) continue;
|
if (taskFileContent == null) continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user