Skip to content

Clear all items #611

@q-depot

Description

@q-depot

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[] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions