Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger update event when file is deleted #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brianrodri
Copy link

@brianrodri brianrodri commented Feb 25, 2025

Fixes #82

Revision numbers are changed by Datastore.delete(id):

/** Delete an object by ID from the index, recursively deleting any child objects as well. */
public delete(id: string): boolean {
if (this._deleteRecursive(id)) {
this.revision++;
return true;
}
return false;
}

Datacore should respond accordingly by triggering an update and rerendering views.

This makes it possible to track the number of notes in a TODO folder, for example:

```datacorejsx
return function() {
    const count = dc.useQuery('@page and path("Brain Dump Folder")').length;
    return count === 1 ? "1 note" : `${count} notes`;
}
```

@brianrodri brianrodri force-pushed the delete-triggers-update branch from 7b4d237 to 0016d9b Compare February 25, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File delete should also trigger datacore update event
1 participant