MCPcopy Create free account
hub / github.com/TanStack/query / countStyleChanges

Function countStyleChanges

packages/query-devtools/src/__tests__/Devtools.test.tsx:178–194  ·  view source on GitHub ↗
(
      container: HTMLElement,
      action: () => void,
    )

Source from the content-addressed store, hash-verified

176 }
177
178 async function countStyleChanges(
179 container: HTMLElement,
180 action: () => void,
181 ) {
182 const content = getViewport(container, 'queries').firstElementChild
183 assert(content)
184 const records: Array<MutationRecord> = []
185 const observer = new MutationObserver((mutations) => {
186 records.push(...mutations)
187 })
188 observer.observe(content, { attributeFilter: ['style'] })
189 action()
190 await vi.advanceTimersByTimeAsync(0)
191 records.push(...observer.takeRecords())
192 observer.disconnect()
193 return records.length
194 }
195
196 function seedQueries() {
197 for (let index = 0; index < 1000; index++) {

Callers 1

Devtools.test.tsxFile · 0.85

Calls 4

getViewportFunction · 0.85
actionFunction · 0.50
observeMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected