Clear all items
Hi,
I'm having an issue with clearing part of the dataset, when I call clearRenderNodes() the data array is empty right before I call db.write, then it's again populated with the previous objects, I tried to both assign [] and set the length, same issue.
Any idea what's going on?
`public async clearRenderNodes(broadcast: boolean = true) { await this.db.read() // this.db.data!.renderNodes = [] if (this.db.data?.renderNodes) this.db.data.renderNodes.length = 0; // clear in-place console.log('this.db.data.renderNodes', this.db.data.renderNodes) await this.db.write() console.log('this.db.data.renderNodes', this.db.data.renderNodes)
this.emit('nodesCleared');
if (broadcast) this.discovery.broadcast({ type: 'clearNodes' });
}`this is my db schema
export type DatabaseDataSchema = { renderJobs: RenderJob[], renderNodes: RenderNode[] }
Source: typicode/lowdb