#after mutation

1 messages · Page 1 of 1 (latest)

flint kettle
#

how do i stop refreshing after a mutation (delete) in the frontend? Want to redirect instead

karmic havenBOT
#

Hi @flint kettle. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. However, Convex's mutations are fully reactive, meaning all query results will be automatically updated after a mutation. If you want to redirect instead of refreshing, you might need to handle this in your application's routing logic after the mutation is completed.

For more information on how Convex handles mutations, you can refer to the Convex documentation (https://docs.convex.dev/client/react#optimistic-updates).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@flint kettle kapa.ai is still learning and improving, please let us know how it did by reacting below

flint kettle
#

@karmic haven is there an option like skip?

karmic havenBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Yes, Convex provides a "skip" option that can be used with the useQuery hook. This option allows you to conditionally skip executing a query based on certain conditions. If "skip" is passed instead of arguments to useQuery, the server won't be called.

Here's an example of how you can use it:

const {isSignedIn} = useAuth();
const myMessages = useQuery(api.messages.list, isSignedIn ? {...params} : "skip");

In this example, the query to fetch messages is only executed if the user is signed in. If the user is not signed in, the "skip" option is passed and the query is not executed.

You can find more information about the "skip" option in the Convex documentation (https://docs.convex.dev/client/react#skipping-queries).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: