Skip to content

How to use custom query ? #752

Answered by jonasnobile
kausik10 asked this question in Support
Discussion options

You must be logged in to vote

Hi, the issue occurs because your fileCount isn't automatically updated when a file is deleted. You're correctly fetching fileCount in the useEffect, but since deletion doesn't trigger the dependencies you specified, the count doesn't update automatically.

A simple and effective solution is to explicitly call your listFiles function again after the delete operation succeeds, like this:

<DeleteEntityTrigger onPersistSuccess={listFiles}>
    <button>Delete file</button>
</DeleteEntityTrigger>

This way, whenever you successfully delete a file, your fileCount state will immediately reflect the changes without requiring a manual reload.

Additionally, to clarify your dependencies, you can safel…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@jonasnobile
Comment options

Comment options

You must be logged in to vote
2 replies
@jonasnobile
Comment options

Answer selected by kausik10
@kausik10
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants