Skip to content

Commit

Permalink
ci: apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Dec 13, 2024
1 parent 76fd305 commit f035539
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
10 changes: 7 additions & 3 deletions packages/query-core/src/queryObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,11 @@ export class QueryObserver<
* Create a new thenable and result promise when the results have changed
*/
const recreateThenable = () => {
console.log('-----------recreateThenable()', 'queryHash:', query.queryHash)
console.log(
'-----------recreateThenable()',
'queryHash:',
query.queryHash,
)
const pending =
(this.#currentThenable =
nextResult.promise =
Expand Down Expand Up @@ -704,8 +708,8 @@ export class QueryObserver<
const typedKey = key as keyof QueryObserverResult
const changed = this.#currentResult[typedKey] !== prevResult[typedKey]
console.log(`changed key "${typedKey}"?`, changed, {
prev: this.#currentResult[typedKey],
next: prevResult[typedKey]
prev: this.#currentResult[typedKey],
next: prevResult[typedKey],
})
return changed
})
Expand Down
5 changes: 3 additions & 2 deletions packages/react-query/src/__tests__/useQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4798,8 +4798,9 @@ describe('useQuery', () => {

expect(count).toBe(2)


const pickedStates = states.map(it => pick(it, ['data', 'isPending', 'isFetching', 'isSuccess', 'isStale']))
const pickedStates = states.map((it) =>
pick(it, ['data', 'isPending', 'isFetching', 'isSuccess', 'isStale']),
)

expect(pickedStates).toMatchInlineSnapshot(`
[
Expand Down
18 changes: 11 additions & 7 deletions packages/react-query/src/__tests__/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,15 @@ export function createDeferred<TValue>() {
}
export type Deferred<TValue> = ReturnType<typeof createDeferred<TValue>>



export function pick<T extends object, K extends keyof T>(obj: T, keys: Array<K>): Pick<T, K> {
return keys.reduce((acc, key) => {
acc[key] = obj[key]
return acc
}, {} as Pick<T, K>)
export function pick<T extends object, K extends keyof T>(
obj: T,
keys: Array<K>,
): Pick<T, K> {
return keys.reduce(
(acc, key) => {
acc[key] = obj[key]
return acc
},
{} as Pick<T, K>,
)
}

0 comments on commit f035539

Please sign in to comment.