Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/preact-query-devtools/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default defineConfig([
'no-redeclare': 'off',
'no-duplicate-imports': 'off',
'no-unused-vars': 'off',
'import/order': 'off',
'sort-imports': 'off',
'no-import-assign': 'off',
// TS-aware version handles overloads correctly
'@typescript-eslint/no-redeclare': 'error',
Expand Down
2 changes: 1 addition & 1 deletion packages/preact-query-devtools/src/PreactQueryDevtools.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useState, useEffect } from 'preact/hooks'
import { useEffect, useRef, useState } from 'preact/hooks'
import { onlineManager, useQueryClient } from '@tanstack/preact-query'
import { TanstackQueryDevtools } from '@tanstack/query-devtools'
import type {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useState, useEffect } from 'preact/hooks'
import { useEffect, useRef, useState } from 'preact/hooks'
import { onlineManager, useQueryClient } from '@tanstack/preact-query'
import { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'
import type { DevtoolsErrorType, Theme } from '@tanstack/query-devtools'
Expand Down
2 changes: 0 additions & 2 deletions packages/preact-query-persist-client/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default defineConfig([
'no-redeclare': 'off',
'no-duplicate-imports': 'off',
'no-unused-vars': 'off',
'import/order': 'off',
'sort-imports': 'off',
'no-import-assign': 'off',
// TS-aware version handles overloads correctly
'@typescript-eslint/no-redeclare': 'error',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, useRef, useState } from 'preact/hooks'
import type { VNode } from 'preact'

import {
persistQueryClientRestore,
Expand All @@ -9,6 +8,7 @@ import {
IsRestoringProvider,
QueryClientProvider,
} from '@tanstack/preact-query'
import type { VNode } from 'preact'
import type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'
import type {
OmitKeyof,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
/** @jsxImportSource preact */
import '@testing-library/jest-dom/vitest'

import type {
PersistedClient,
Persister,
} from '../../../query-persist-client-core/src'
import { persistQueryClientSave } from '../../../query-persist-client-core/src'
import { notifyManager, noop } from '../../../query-core/src'
import { act, cleanup, render } from '@testing-library/preact'
import type { UseQueryResult } from '../../../preact-query/src'
import { QueryClient, useQuery } from '../../../preact-query/src'
import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { queryKey, sleep } from '@tanstack/query-test-utils'
import { QueryClient, useQuery } from '../../../preact-query/src'
import { noop, notifyManager } from '../../../query-core/src'
import { persistQueryClientSave } from '../../../query-persist-client-core/src'

import { PersistQueryClientProvider } from './testPersistProvider'
import type { UseQueryResult } from '../../../preact-query/src'
import type {
PersistedClient,
Persister,
} from '../../../query-persist-client-core/src'

notifyManager.setNotifyFunction((fn) => {
act(fn)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @jsxRuntime automatic */
/** @jsxImportSource preact */
import { useEffect, useRef, useState } from 'preact/hooks'
import {
persistQueryClientRestore,
persistQueryClientSubscribe,
Expand All @@ -9,7 +10,6 @@ import {
QueryClientProvider,
} from '../../../preact-query/src'
import type { ComponentChildren } from 'preact'
import { useEffect, useRef, useState } from 'preact/hooks'

type Props = {
children?: ComponentChildren
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
/** @jsxImportSource preact */
import '@testing-library/jest-dom/vitest'

import type { QueryObserverResult } from '../../../query-core/src'
import { notifyManager } from '../../../query-core/src'
import type {
PersistedClient,
Persister,
} from '../../../query-persist-client-core/src'
import { act, cleanup, render } from '@testing-library/preact'
import { QueryClient, useQueries } from '../../../preact-query/src'
import { useCallback } from 'preact/hooks'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { sleep } from '@tanstack/query-test-utils'
import { QueryClient, useQueries } from '../../../preact-query/src'
import { notifyManager } from '../../../query-core/src'

import { PersistQueryClientProvider } from './testPersistProvider'
import type {
PersistedClient,
Persister,
} from '../../../query-persist-client-core/src'
import type { QueryObserverResult } from '../../../query-core/src'

notifyManager.setNotifyFunction((fn) => {
act(fn)
Expand Down
2 changes: 0 additions & 2 deletions packages/preact-query/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default defineConfig([
'no-redeclare': 'off',
'no-duplicate-imports': 'off',
'no-unused-vars': 'off',
'import/order': 'off',
'sort-imports': 'off',
'no-import-assign': 'off',
// TS-aware version handles overloads correctly
'@typescript-eslint/no-redeclare': 'error',
Expand Down
10 changes: 5 additions & 5 deletions packages/preact-query/src/HydrationBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { hydrate } from '@tanstack/query-core'
import { Fragment } from 'preact'
import { useEffect, useMemo, useRef } from 'preact/hooks'

import { useQueryClient } from './QueryClientProvider'
import type { ComponentChildren } from 'preact'
import type {
DehydratedState,
HydrateOptions,
OmitKeyof,
QueryClient,
} from '@tanstack/query-core'
import { Fragment } from 'preact'
import type { ComponentChildren } from 'preact'
import { useEffect, useMemo, useRef } from 'preact/hooks'

import { useQueryClient } from './QueryClientProvider'

/**
* The props accepted by `HydrationBoundary`.
Expand Down
4 changes: 2 additions & 2 deletions packages/preact-query/src/QueryClientProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { QueryClient } from '@tanstack/query-core'
import { createContext } from 'preact'
import type { ComponentChildren, VNode } from 'preact'
import { useContext, useEffect } from 'preact/hooks'
import type { QueryClient } from '@tanstack/query-core'
import type { ComponentChildren, VNode } from 'preact'

/**
* The context that `useQueryClient` reads from. `QueryClientProvider` is the normal way to set it.
Expand Down
2 changes: 1 addition & 1 deletion packages/preact-query/src/QueryErrorResetBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext } from 'preact'
import type { ComponentChildren } from 'preact'
import { useContext, useState } from 'preact/hooks'
import type { ComponentChildren } from 'preact'

// CONTEXT

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createElement, Component } from 'preact'
import { Component, createElement } from 'preact'
import { ErrorBoundaryContext } from './ErrorBoundaryContext'
import type { ErrorInfo } from 'preact'

import { ErrorBoundaryContext } from './ErrorBoundaryContext'
import type { ErrorBoundaryProps, FallbackProps } from './types'

type ErrorBoundaryState =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as coreModule from '@tanstack/query-core'
import type { hydrate } from '@tanstack/query-core'
import { queryKey, sleep } from '@tanstack/query-test-utils'
import { render } from '@testing-library/preact'
import { Suspense, startTransition } from 'preact/compat'
import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import {
HydrationBoundary,
Expand All @@ -13,6 +12,7 @@ import {
noop,
useQuery,
} from '..'
import type { hydrate } from '@tanstack/query-core'

describe('Preact hydration', () => {
const stringKey = queryKey()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { queryKey, sleep } from '@tanstack/query-test-utils'
import { render } from '@testing-library/preact'
import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import {
QueryCache,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { QueryClient, dataTagSymbol, skipToken } from '@tanstack/query-core'
import type {
DataTag,
InfiniteData,
InitialDataFunction,
} from '@tanstack/query-core'
import { queryKey } from '@tanstack/query-test-utils'
import { assertType, describe, expectTypeOf, it } from 'vitest'

import { infiniteQueryOptions } from '../infiniteQueryOptions'
import { useInfiniteQuery } from '../useInfiniteQuery'
import { useQuery } from '../useQuery'
import { useSuspenseInfiniteQuery } from '../useSuspenseInfiniteQuery'
import type {
DataTag,
InfiniteData,
InitialDataFunction,
} from '@tanstack/query-core'

// Regression test for exported infiniteQueryOptions inference under declaration emit.
// TypeScript should be able to name the return type without expanding the
Expand Down
10 changes: 5 additions & 5 deletions packages/preact-query/src/__tests__/mutationOptions.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { QueryClient } from '@tanstack/query-core'
import { queryKey } from '@tanstack/query-test-utils'
import { assertType, describe, expectTypeOf, it } from 'vitest'

import { useIsMutating, useMutation, useMutationState } from '..'
import { mutationOptions } from '../mutationOptions'
import type {
DefaultError,
MutationFunctionContext,
MutationState,
WithRequired,
} from '@tanstack/query-core'
import { queryKey } from '@tanstack/query-test-utils'
import { assertType, describe, expectTypeOf, it } from 'vitest'

import { useIsMutating, useMutation, useMutationState } from '..'
import { mutationOptions } from '../mutationOptions'
import type { UseMutationOptions, UseMutationResult } from '../types'

describe('mutationOptions', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { QueryClient } from '@tanstack/query-core'
import type { MutationState } from '@tanstack/query-core'
import { queryKey, sleep } from '@tanstack/query-test-utils'
import { fireEvent } from '@testing-library/preact'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import { useIsMutating, useMutation, useMutationState } from '..'
import { mutationOptions } from '../mutationOptions'
import { renderWithClient } from './utils'
import type { MutationState } from '@tanstack/query-core'
import type { UseMutationOptions } from '../types'

describe('mutationOptions', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/preact-query/src/__tests__/ssr-hydration.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { queryKey } from '@tanstack/query-test-utils'
import { act } from '@testing-library/preact'
import { hydrate as preactHydrate, render } from 'preact'
import type { VNode } from 'preact'
import { renderToString } from 'preact-render-to-string'
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'

Expand All @@ -15,6 +14,7 @@ import {
useQuery,
} from '..'
import { setIsServer } from './utils'
import type { VNode } from 'preact'

const PreactHydrate = (element: VNode, container: Element) => {
act(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/preact-query/src/__tests__/suspense.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { queryKey, sleep } from '@tanstack/query-test-utils'
import { render } from '@testing-library/preact'
import type { ComponentChildren } from 'preact'
import { Suspense } from 'preact/compat'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import { QueryClient, QueryClientProvider, useSuspenseQuery } from '..'
import type { ComponentChildren } from 'preact'
import type { StaleTime } from '@tanstack/query-core'
import type { QueryKey } from '..'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { QueryClient } from '@tanstack/query-core'
import type { InfiniteData } from '@tanstack/query-core'
import { queryKey } from '@tanstack/query-test-utils'
import { describe, expectTypeOf, it } from 'vitest'

import type { UseInfiniteQueryOptions } from '../types'
import { useInfiniteQuery } from '../useInfiniteQuery'
import type { UseInfiniteQueryOptions } from '../types'
import type { InfiniteData } from '@tanstack/query-core'

describe('pageParam', () => {
it('should define type of param passed to queryFunctionContext with initialPageParam', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/preact-query/src/__tests__/useInfiniteQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { queryKey, sleep } from '@tanstack/query-test-utils'
import { fireEvent, render } from '@testing-library/preact'
import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { Mock } from 'vitest'

import {
QueryCache,
QueryClient,
Expand All @@ -12,12 +10,14 @@ import {
skipToken,
useInfiniteQuery,
} from '..'
import { renderWithClient, setActTimeout } from './utils'
import type { Mock } from 'vitest'

import type {
InfiniteData,
QueryFunctionContext,
UseInfiniteQueryResult,
} from '..'
import { renderWithClient, setActTimeout } from './utils'

// import { Suspense } from 'preact/compat'

Expand Down
2 changes: 1 addition & 1 deletion packages/preact-query/src/__tests__/useMutation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { useEffect, useState } from 'preact/hooks'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import { MutationCache, QueryCache, QueryClient, useMutation } from '..'
import type { UseMutationResult } from '../types'
import { ErrorBoundary } from './ErrorBoundary'
import {
mockOnlineManagerIsOnline,
renderWithClient,
setActTimeout,
} from './utils'
import type { UseMutationResult } from '../types'

describe('useMutation', () => {
let queryCache: QueryCache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { queryKey, sleep } from '@tanstack/query-test-utils'
import { fireEvent } from '@testing-library/preact'
import type { VNode } from 'preact'
import { Suspense } from 'preact/compat'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

Expand All @@ -12,6 +11,7 @@ import {
useSuspenseInfiniteQuery,
} from '..'
import { renderWithClient } from './utils'
import type { VNode } from 'preact'

describe('usePrefetchInfiniteQuery', () => {
let queryCache: QueryCache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { queryKey, sleep } from '@tanstack/query-test-utils'
import { act, fireEvent } from '@testing-library/preact'
import type { VNode } from 'preact'
import { Suspense } from 'preact/compat'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

Expand All @@ -14,6 +13,7 @@ import {
} from '..'
import { ErrorBoundary } from './ErrorBoundary'
import { renderWithClient } from './utils'
import type { VNode } from 'preact'

describe('usePrefetchQuery', () => {
let queryCache: QueryCache
Expand Down
4 changes: 2 additions & 2 deletions packages/preact-query/src/__tests__/useQueries.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { queryKey } from '@tanstack/query-test-utils'
import { describe, expectTypeOf, it } from 'vitest'

import { skipToken } from '..'
import type { OmitKeyof, QueryFunction, QueryKey } from '..'
import { queryOptions } from '../queryOptions'
import type { UseQueryOptions, UseQueryResult } from '../types'
import { useQueries } from '../useQueries'
import type { OmitKeyof, QueryFunction, QueryKey } from '..'
import type { UseQueryOptions, UseQueryResult } from '../types'
import type { QueryFunctionContext } from '@tanstack/query-core'

describe('useQueries', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/preact-query/src/__tests__/useQueries.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { useCallback, useEffect, useState } from 'preact/hooks'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import { IsRestoringProvider, QueryCache, QueryClient, useQueries } from '..'
import type { QueryObserverResult, UseQueryResult } from '..'
import { ErrorBoundary } from './ErrorBoundary'
import { renderWithClient } from './utils'
import type { QueryObserverResult, UseQueryResult } from '..'

describe('useQueries', () => {
let queryCache: QueryCache
Expand Down
Loading
Loading