Skip to content

Commit

Permalink
Assorted other cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Oct 18, 2022
1 parent 1696f7a commit feccd87
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 0 additions & 2 deletions packages/toolkit/src/query/core/buildThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,6 @@ In the case of an unhandled error, no tags will be "provided" or "invalidated".`
const endpointDefinition =
endpointDefinitions[queryThunkArgs.endpointName]

// console.trace('Query thunk: ', currentArg)

// Order of these checks matters.
// In order for `upsertQueryData` to successfully run while an existing request is in flight,
/// we have to check for that first, otherwise `queryThunk` will bail out and not run at all.
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/react/buildHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
requestId,
})
)
// console.log('Probe subscription check: ', returnedValue)

currentRenderHasSubscription = !!returnedValue
}

Expand Down
10 changes: 4 additions & 6 deletions packages/toolkit/src/query/tests/buildHooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ let actions: AnyAction[] = []

const storeRef = setupApiStore(
api,
{
// actions(state: AnyAction[] = [], action: AnyAction) {
// return [...state, action]
// },
},
{},
{
middleware: {
prepend: [listenerMiddleware.middleware],
Expand Down Expand Up @@ -133,7 +129,9 @@ describe('hooks tests', () => {
}

render(<User />, { wrapper: storeRef.wrapper })
expect(getRenderCount()).toBe(2) // By the time this runs, the initial render will happen, and the query will start immediately running by the time we can expect this
// By the time this runs, the initial render will happen, and the query
// will start immediately running by the time we can expect this
expect(getRenderCount()).toBe(2)

await waitFor(() =>
expect(screen.getByTestId('isFetching').textContent).toBe('false')
Expand Down

0 comments on commit feccd87

Please sign in to comment.