* Gets the current state of the collection as an Array, but only resolves when data is available * Waits for the first sync commit to complete before resolving * * @returns Promise that resolves to an Array containing all items in the collection
()
| 858 | * @returns Promise that resolves to an Array containing all items in the collection |
| 859 | */ |
| 860 | toArrayWhenReady(): Promise<Array<WithVirtualProps<TOutput, TKey>>> { |
| 861 | // If we already have data or collection is ready, resolve immediately |
| 862 | if (this.size > 0 || this.isReady()) { |
| 863 | return Promise.resolve(this.toArray) |
| 864 | } |
| 865 | |
| 866 | // Use preload to ensure the collection starts loading, then return the array |
| 867 | return this.preload().then(() => this.toArray) |
| 868 | } |
| 869 | |
| 870 | /** |
| 871 | * Returns the current state of the collection as an array of changes |
no test coverage detected