useCommandState - create reactive state that updates via commands.
Auto-cleanup on Vue component unmount or scope disposal.
// Immediate mode (default):const { state } = useCommandState([], { cartAdd: (s, cmd) => [...s, cmd.target] }); Copy
// Immediate mode (default):const { state } = useCommandState([], { cartAdd: (s, cmd) => [...s, cmd.target] });
// Coalesced mode — batch writes for v-for lists:const { state } = useCommandState([], { cartAdd: (s, cmd) => [...s, cmd.target] }, { coalesce: true }); Copy
// Coalesced mode — batch writes for v-for lists:const { state } = useCommandState([], { cartAdd: (s, cmd) => [...s, cmd.target] }, { coalesce: true });
useCommandState - create reactive state that updates via commands.
Auto-cleanup on Vue component unmount or scope disposal.