store-data-structures

Separate Zustand list arrays and detail maps with reducer-driven updates.

Updated Mar 2, 2026
One-click install
npx skills add https://github.com/Staysr/lobe-windos-build --skill store-data-structures
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: store-data-structures
Source: https://github.com/Staysr/lobe-windos-build/tree/main/.agents/skills/store-data-structures
Command: npx skills add https://github.com/Staysr/lobe-windos-build --skill store-data-structures

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Zustand store design often mixes list data and detailed pages, leading to hard-to-maintain state, duplicated fetches, and poor performance. This Skill guides you to split list state (arrays) from detail state (maps) to enable fast navigation and optimistic updates.

Core Features & Use Cases

  • Clear separation of list data (arrays) and detail data (maps) for multiple open pages.
  • Use Map for detail pages to cache and update items individually with per-item loading states.
  • Reducer-based immutable updates (Immer) and type-safe actions for predictable state changes.
  • Strong guidance on computed/UI-friendly list types and documentation practices.

Quick Start

Create a Zustand store slice with a list array named xxxList and a detail map named xxxDetailMap, and implement a reducer to manage set/update/delete of detail entries.

Frequently Asked Questions about store-data-structures

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

FAQPage Schema
How do I separate list and detail state in Zustand to avoid duplicated fetches?▼

To separate list and detail state in Zustand, store list data in arrays and cache detailed views in a map using a reducer-driven detail map. This pattern enables fast navigation and individual item updates without duplicated fetches.

What is the best way to structure Zustand stores for dashboards and detail pages?▼

The best way to structure Zustand stores for dashboards and detail pages is splitting list state into arrays and detail state into maps. This supports optimistic updates, per-item loading states, and type-safe definitions for scalable applications.

How do I manage per-item loading states in a Zustand store?▼

Manage per-item loading states in a Zustand store by caching detailed views in a map. This reducer-driven detail map tracks individual item fetching states, allowing granular UI updates when navigating between multiple open pages.

Can I use Immer for immutable updates in a Zustand store with list and detail data?▼

Yes, you can use Immer for immutable updates in a Zustand store with list and detail data. Reducer-based immutable updates with Immer ensure predictable state changes across your list arrays and detail maps.

How do I handle optimistic updates in Zustand when managing list and detail views?▼

Handle optimistic updates in Zustand by separating list data into arrays and caching detail views in a map. This split allows you to immediately reflect changes in the UI while managing individual item updates predictably.