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
22 changes: 22 additions & 0 deletions .changeset/v6-browser-targets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@tanstack/lit-query': major
'@tanstack/preact-query': major
'@tanstack/preact-query-devtools': major
'@tanstack/preact-query-persist-client': major
'@tanstack/query-async-storage-persister': major
'@tanstack/query-broadcast-client-experimental': major
'@tanstack/query-core': major
'@tanstack/query-devtools': major
'@tanstack/query-persist-client-core': major
'@tanstack/react-query': major
'@tanstack/react-query-devtools': major
'@tanstack/react-query-next-experimental': major
'@tanstack/react-query-persist-client': major
'@tanstack/solid-query': major
'@tanstack/solid-query-devtools': major
'@tanstack/solid-query-persist-client': major
'@tanstack/vue-query': major
'@tanstack/vue-query-devtools': major
---

Update the minimum browser versions to Chrome 119, Edge 119, Firefox 121, Safari 17.4, Safari on iOS 17.4, and Opera 105. If you support older browsers, transpile the library and add any polyfills your environment needs.
16 changes: 9 additions & 7 deletions docs/framework/lit/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ The snippets in these docs declare reactive properties with `static properties`
}
```

TanStack Query is optimized for modern browsers:
TanStack Query supports these browser versions and later.

```txt
Chrome >= 91
Firefox >= 90
Edge >= 91
Safari >= 15
iOS >= 15
Opera >= 77
Chrome 119
Firefox 121
Edge 119
Safari 17.4
Safari on iOS 17.4
Opera 105
```

> Depending on your environment, you might need to add polyfills. If you want to support older browsers, you need to transpile the library from `node_modules` yourselves.

## Provider Setup

Create a `QueryClient`, provide it with `QueryClientProvider`, and register your custom element. The package exports the provider class but does not call `customElements.define` for you.
Expand Down
18 changes: 9 additions & 9 deletions docs/framework/react/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ If you're not using a module bundler or package manager, you can also use this l

TanStack Query v6 ships ESM builds only. If your application uses webpack 4, upgrade to webpack 5 or another bundler that supports the modern build.

React Query is optimized for modern browsers. It is compatible with the following browsers config

```
Chrome >= 91
Firefox >= 90
Edge >= 91
Safari >= 15
iOS >= 15
Opera >= 77
TanStack Query supports these browser versions and later.

```txt
Chrome 119
Firefox 121
Edge 119
Safari 17.4
Safari on iOS 17.4
Opera 105
```

> Depending on your environment, you might need to add polyfills. If you want to support older browsers, you need to transpile the library from `node_modules` yourselves.
Expand Down
18 changes: 9 additions & 9 deletions docs/framework/solid/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ If you're not using a module bundler or package manager, you can also use this l

### Requirements

Solid Query is optimized for modern browsers. It is compatible with the following browsers config

```
Chrome >= 91
Firefox >= 90
Edge >= 91
Safari >= 15
iOS >= 15
Opera >= 77
TanStack Query supports these browser versions and later.

```txt
Chrome 119
Firefox 121
Edge 119
Safari 17.4
Safari on iOS 17.4
Opera 105
```

> Depending on your environment, you might need to add polyfills. If you want to support older browsers, you need to transpile the library from `node_modules` yourselves.
1 change: 1 addition & 0 deletions packages/eslint-plugin-query/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import { getTsdownConfig } from './root.tsdown.config.js'

export default defineConfig({
...getTsdownConfig({ entry: ['src/*.ts'] }),
target: 'es2022',
deps: { neverBundle: ['typescript'] },
})
2 changes: 1 addition & 1 deletion packages/lit-query/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "./dist-ts",
"rootDir": ".",
"lib": ["ES2022", "DOM"]
"lib": ["ES2022", "ES2024.Promise", "DOM"]
},
"include": [
"src",
Expand Down
5 changes: 2 additions & 3 deletions packages/query-core/src/infiniteQueryBehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,11 @@ function getNextPageParam(
options: InfiniteQueryPageParamsOptions<any>,
{ pages, pageParams }: InfiniteData<unknown>,
): unknown | undefined {
const lastIndex = pages.length - 1
return pages.length > 0
? options.getNextPageParam(
pages[lastIndex],
pages.at(-1),
pages,
pageParams[lastIndex],
pageParams.at(-1),
pageParams,
)
: undefined
Expand Down
12 changes: 5 additions & 7 deletions packages/query-core/src/retryer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,11 @@ export function createRetryer<TData = unknown, TError = DefaultError>(
let failureCount = 0
let continueFn: ((value?: unknown) => void) | undefined
let status: RetryerStatus = 'pending'
let promiseResolve: (data: TData) => void
let promiseReject: (error: TError) => void

const promise = new Promise<TData>((resolve, reject) => {
promiseResolve = resolve
promiseReject = reject
})
const {
promise,
resolve: promiseResolve,
reject: promiseReject,
} = Promise.withResolvers<TData>()
promise.catch(noop)

const isResolved = () => status !== 'pending'
Expand Down
6 changes: 2 additions & 4 deletions packages/query-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,6 @@ export function partialMatchKey(
return false
}

const hasOwn = Object.prototype.hasOwnProperty

/**
* This function returns `a` if `b` is deeply equal.
* If not, it will replace any deeply equal children of `b` with those of `a`.
Expand Down Expand Up @@ -468,7 +466,7 @@ function replaceEqualDeepInternal(

if (equalityFn(aItem, bItem)) {
copy[key] = aItem
if (array ? i < aSize : hasOwn.call(a, key)) equalItems++
if (array ? i < aSize : Object.hasOwn(a, key)) equalItems++
continue
}

Expand Down Expand Up @@ -505,7 +503,7 @@ export function shallowEqualObjects<T extends Record<string, any>>(
}

for (const key of Object.keys(a)) {
if (!hasOwn.call(b, key) || a[key] !== b[key]) {
if (!Object.hasOwn(b, key) || a[key] !== b[key]) {
return false
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/query-devtools/root.tsdown.config.js
3 changes: 2 additions & 1 deletion packages/query-devtools/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createRequire } from 'node:module'
import { dirname, resolve } from 'node:path'
import { defineConfig } from 'tsdown'
import solid from 'unplugin-solid/rolldown'
import { browserTargets } from './root.tsdown.config.js'
import type { UserConfig } from 'tsdown'

const require = createRequire(import.meta.url)
Expand Down Expand Up @@ -52,7 +53,7 @@ const inlineCss = () => ({
})

const baseConfig: UserConfig = {
target: 'esnext',
target: browserTargets,
platform: 'neutral',
alias: {
'solid-transition-group': 'solid-transition-group/dist/index.js',
Expand Down
1 change: 1 addition & 0 deletions packages/solid-query-devtools/root.tsdown.config.js
3 changes: 2 additions & 1 deletion packages/solid-query-devtools/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { defineConfig } from 'tsdown'
import solid from 'unplugin-solid/rolldown'
import { browserTargets } from './root.tsdown.config.js'
import type { UserConfig } from 'tsdown'

const baseConfig: UserConfig = {
target: 'esnext',
target: browserTargets,
platform: 'browser',
format: 'esm',
outDir: 'build',
Expand Down
1 change: 1 addition & 0 deletions packages/solid-query-persist-client/root.tsdown.config.js
3 changes: 2 additions & 1 deletion packages/solid-query-persist-client/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { defineConfig } from 'tsdown'
import solid from 'unplugin-solid/rolldown'
import { browserTargets } from './root.tsdown.config.js'
import type { UserConfig } from 'tsdown'

const baseConfig: UserConfig = {
target: 'esnext',
target: browserTargets,
platform: 'browser',
format: 'esm',
outDir: 'build',
Expand Down
1 change: 1 addition & 0 deletions packages/solid-query/root.tsdown.config.js
3 changes: 2 additions & 1 deletion packages/solid-query/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { defineConfig } from 'tsdown'
import solid from 'unplugin-solid/rolldown'
import { browserTargets } from './root.tsdown.config.js'
import type { UserConfig } from 'tsdown'

const baseConfig: UserConfig = {
target: 'esnext',
target: browserTargets,
platform: 'browser',
format: 'esm',
outDir: 'build',
Expand Down
6 changes: 2 additions & 4 deletions packages/vue-query-devtools/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { defineConfig } from 'tsdown'
import vue from 'unplugin-vue/vite'
import { browserTargets } from './root.tsdown.config.js'

export default defineConfig({
plugins: [vue()],
entry: ['src/**/*.ts', '!src/__tests__/**'],
format: ['esm'],
target: ['chrome91', 'firefox90', 'edge91', 'safari15', 'ios15', 'opera77'],
// Rolldown lowers private fields for browser target arrays. Keep the
// transform target at ES2022 to match the syntax that tsup emitted.
inputOptions: { transform: { target: 'es2022' } },
target: browserTargets,
outDir: 'dist',
unbundle: true,
dts: true,
Expand Down
15 changes: 11 additions & 4 deletions scripts/getTsdownConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
// @ts-check

// Query Core uses Promise.withResolvers().
export const browserTargets = [
'chrome119',
'firefox121',
'edge119',
'safari17.4',
'ios17.4',
'opera105',
]

/**
* @param {Object} opts - Options for building configurations.
* @param {string[]} opts.entry - The entry array.
Expand All @@ -9,10 +19,7 @@ export function getTsdownConfig(opts) {
return {
entry: opts.entry,
format: 'esm',
target: ['chrome91', 'firefox90', 'edge91', 'safari15', 'ios15', 'opera77'],
// Rolldown lowers private fields for browser target arrays. Keep the
// transform target at ES2022 to match the syntax that tsup emitted.
inputOptions: { transform: { target: 'es2022' } },
target: browserTargets,
outDir: 'build',
dts: true,
fixedExtension: false,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"lib": ["DOM", "DOM.Iterable", "ES2022", "ES2024.Promise"],
"module": "ESNext",
"moduleResolution": "Bundler",
"noEmit": false,
Expand Down
Loading