(
callback: () => Collection)
| 44 | } |
| 45 | |
| 46 | export function useDataApiQuery<Collection extends IDataCollection>( |
| 47 | callback: () => Collection): Collection { |
| 48 | let storedCollection = useRef<Collection|null>(null); |
| 49 | if (storedCollection.current === null || !storedCollection.current.isValid()) { |
| 50 | if (storedCollection.current !== null) { |
| 51 | storedCollection.current.close(); |
| 52 | } |
| 53 | storedCollection.current = callback(); |
| 54 | } |
| 55 | return storedCollection.current; |
| 56 | } |
| 57 | |
| 58 | function arrayElementsEqual<T>(a: any[], b: any[]) { |
| 59 | if (a.length !== b.length) { |
no test coverage detected