1// React binding of the collection store (wix/cms/collection-store.ts) — the list state machine2// lives there, framework-free; this hook subscribes to one instance per mounted listing. SSR-friendly:3// pass server-fetched items as `initialItems` (Astro frontmatter / server component) and no client4// fetch happens for the first page; a SPA passes nothing. Changing filters/sort (by value) refetches5// behind the items on screen (`fetching`); loadMore() appends the next page, goToPage(n) replaces6// it, refresh() re-reads after a write. Astro islands and React SPAs use this; a static page, Vue,7// or Svelte uses the store directly.8import { useEffect, useRef, useSyncExternalStore } from "react";9import { createCollectionStore, type CollectionStore } from "../../wix/cms/collection-store";10