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 it's caching logic to queries. Mutations and subscriptions are excluded from the deduplication process.

import { useClient, dedup, fetch } from 'villus';

useClient({
  use: [dedup(), fetch()],
});

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