Dedup Plugin
The dedup plugin removes any duplicate pending queries from executing which means you can safely run the same queries at the same time without worrying about excessive requests.
The dedup plugin only applies its caching logic to queries. Mutations and subscriptions are excluded from the deduplication process.
vue<script setup>
import { useClient, dedup, fetch } from 'villus';
useClient({
use: [dedup(), fetch()],
});
</script>
tip
The dedup plugin is one of the default plugins that are pre-configured with any villus client unless specified otherwise
Options
At this moment the dedup plugin doesn’t have any options to customize
Code
You can check the source code for the dedup
plugin and use it as a reference to build your own