( collection: Collection<T>, ids: Array<string>, )
| 68 | * Check if a collection has ONLY loaded specific IDs (no extras) |
| 69 | */ |
| 70 | export function hasOnlyLoadedIds<T extends { id: string }>( |
| 71 | collection: Collection<T>, |
| 72 | ids: Array<string>, |
| 73 | ): boolean { |
| 74 | const loadedIds = getLoadedIds(collection) |
| 75 | const idsSet = new Set(ids) |
| 76 | |
| 77 | // Check that all loaded IDs are in expected IDs |
| 78 | if (!loadedIds.every((id) => idsSet.has(id))) { |
| 79 | return false |
| 80 | } |
| 81 | |
| 82 | // Check that all expected IDs are loaded |
| 83 | if (!ids.every((id) => loadedIds.includes(id))) { |
| 84 | return false |
| 85 | } |
| 86 | |
| 87 | return true |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Wait for a collection to reach a specific size |
nothing calls this directly
no test coverage detected