MCPcopy
hub / github.com/buildbot/buildbot / useDataApiQuery

Function useDataApiQuery

www/data-module/src/data/ReactUtils.ts:46–56  ·  view source on GitHub ↗
(
    callback: () => Collection)

Source from the content-addressed store, hash-verified

44}
45
46export 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
58function arrayElementsEqual<T>(a: any[], b: any[]) {
59 if (a.length !== b.length) {

Calls 2

isValidMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected