(options: LoadSubsetOptions)
| 1699 | * by TanStack Query, allowing quick remounts to restore data without refetching. |
| 1700 | */ |
| 1701 | const unloadSubset = (options: LoadSubsetOptions) => { |
| 1702 | // 1. Same predicates → 2. Same queryKey |
| 1703 | const key = generateQueryKeyFromOptions(options) |
| 1704 | const hashedQueryKey = hashKey(key) |
| 1705 | |
| 1706 | // 3. Decrement refcount |
| 1707 | const currentCount = queryRefCounts.get(hashedQueryKey) || 0 |
| 1708 | const newCount = currentCount - 1 |
| 1709 | |
| 1710 | // Update refcount |
| 1711 | if (newCount <= 0) { |
| 1712 | queryRefCounts.set(hashedQueryKey, 0) |
| 1713 | cleanupQueryIfIdle(hashedQueryKey) |
| 1714 | } else { |
| 1715 | // Still have other references, just decrement |
| 1716 | queryRefCounts.set(hashedQueryKey, newCount) |
| 1717 | } |
| 1718 | } |
| 1719 | |
| 1720 | // Create deduplicated loadSubset wrapper for non-eager modes |
| 1721 | // This prevents redundant snapshot requests when multiple concurrent |
nothing calls this directly
no test coverage detected