Skip to content

Commit

Permalink
proper clean up value cache
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Dec 19, 2018
1 parent daa746d commit 24833d1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/provider/DirectRenderTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ export class DirectRenderTasks extends ARenderTasks implements IRenderTaskExectu
setData(data: IDataRow[]) {
this.data = data;
this.cache.clear();
this.valueCacheData.clear();
}


dirtyColumn(col: Column, type: 'data' | 'summary' | 'group') {
super.dirtyColumn(col, type);

if (type === 'group') {
return; // not cached
}
Expand Down
3 changes: 2 additions & 1 deletion src/provider/ScheduledTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class ScheduleRenderTasks extends ARenderTasks implements IRenderTaskExec
}

dirtyColumn(col: Column, type: 'data' | 'group' | 'summary') {
super.dirtyColumn(col, type);
// order designed such that first groups, then summaries, then data is deleted

for (const key of Array.from(this.cache.keys()).sort()) {
Expand Down Expand Up @@ -84,7 +85,7 @@ export class ScheduleRenderTasks extends ARenderTasks implements IRenderTaskExec
}

for (const col of cols) {
this.valueCacheData.delete(col.id);
super.dirtyColumn(col, type);
this.workers.deleteRef(col.id);
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/provider/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ export class ARenderTasks {
return this.builderForEach(b, order, (i: number) => col.iterCategory(this.data[i]), build);
}

dirtyColumn(col: Column, type: 'data' | 'summary' | 'group') {
if (type !== 'data') {
return;
}
this.valueCacheData.delete(col.id);
}

protected setValueCacheData(key: string, value: Float32Array | UIntTypedArray | Int32Array | null) {
if (value == null) {
Expand Down

0 comments on commit 24833d1

Please sign in to comment.