tanstack-query

Manage server state and data fetching in Svelte with TanStack Query.

2.5k|507|Updated Feb 7, 2014
One-click install
npx skills add https://github.com/exceptionless/Exceptionless --skill tanstack-query-exceptionless
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-query
Source: https://github.com/exceptionless/Exceptionless/tree/main/.agents/skills/tanstack-query
Command: npx skills add https://github.com/exceptionless/Exceptionless --skill tanstack-query-exceptionless

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill streamlines data fetching, server state management, and API mutations within Svelte frontends, simplifying complex asynchronous operations and improving application performance.

Core Features & Use Cases

  • Data Fetching: Efficiently fetch data from APIs using createQuery.
  • State Management: Manage server cache, loading, and error states automatically.
  • API Mutations: Handle data modifications (create, update, delete) with createMutation, including optimistic updates and cache invalidation.
  • Use Case: When building a dashboard that displays a list of organizations and allows users to create new ones, this Skill ensures data is fetched efficiently, updates are reflected instantly, and errors are handled gracefully.

Quick Start

Use the tanstack-query skill to create a query for fetching organizations from the API.

Frequently Asked Questions about tanstack-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage server state and API data fetching in a Svelte application?

To manage server state and API data fetching in Svelte, you can use TanStack Query to handle asynchronous operations, automatic caching, and state synchronization. It streamlines loading and error states while fetching data efficiently.

What is the best way to handle API mutations and cache invalidation in Svelte?

The best way to handle API mutations in Svelte is using a dedicated query client to manage data modifications. It supports create, update, and delete operations while automatically invalidating caches and applying optimistic updates.

How do I fetch data from an API using TanStack Query in Svelte?

To fetch data in Svelte using TanStack Query, utilize the createQuery function. This integrates with your fetch client to execute API calls, automatically managing the server cache and synchronizing state for dynamic user interfaces.

Can I use TanStack Query to update a dashboard instantly after creating new data?

Yes, TanStack Query can update a Svelte dashboard instantly after creating new data. By using createMutation, it handles data modifications and reflects updates immediately through cache invalidation and optimistic updates.

Does TanStack Query handle loading and error states automatically for Svelte apps?

TanStack Query does handle loading and error states automatically for Svelte applications. It manages the server cache internally, ensuring that asynchronous data operations reflect accurate states without manual intervention.