Skip to content

Commit b589755

Browse files
authored
Merge branch 'v4' into v4-suspensive-react-query-links
2 parents 7d66e6d + 39afe4a commit b589755

File tree

7 files changed

+29
-47
lines changed

7 files changed

+29
-47
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- 'alpha'
1313
- 'beta'
1414
- 'rc'
15+
- 'v4'
1516

1617
concurrency:
1718
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
@@ -23,7 +24,7 @@ env:
2324

2425
jobs:
2526
test-and-publish:
26-
if: github.repository == 'TanStack/query' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/rc')
27+
if: github.repository == 'TanStack/query'
2728
name: 'Test & Publish'
2829
runs-on: ubuntu-latest
2930
steps:

packages/vue-query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/vue-query",
3-
"version": "4.37.0",
3+
"version": "4.37.1",
44
"description": "Hooks for managing, caching and syncing asynchronous and remote data in Vue",
55
"author": "Damian Osipiuk",
66
"license": "MIT",

packages/vue-query/src/useInfiniteQuery.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import type { UseQueryReturnType } from './useBaseQuery'
1111

1212
import type {
1313
DeepUnwrapRef,
14-
DistributiveOmit,
1514
VueInfiniteQueryObserverOptions,
1615
WithQueryClientKey,
1716
} from './types'
@@ -31,23 +30,11 @@ export type UseInfiniteQueryOptions<
3130
>
3231
>
3332

34-
type InfiniteQueryReturnType<TData, TError> = UseQueryReturnType<
33+
export type UseInfiniteQueryReturnType<TData, TError> = UseQueryReturnType<
3534
TData,
3635
TError,
3736
InfiniteQueryObserverResult<TData, TError>
3837
>
39-
export type UseInfiniteQueryReturnType<TData, TError> = DistributiveOmit<
40-
InfiniteQueryReturnType<TData, TError>,
41-
'fetchNextPage' | 'fetchPreviousPage' | 'refetch' | 'remove'
42-
> & {
43-
fetchNextPage: InfiniteQueryObserverResult<TData, TError>['fetchNextPage']
44-
fetchPreviousPage: InfiniteQueryObserverResult<
45-
TData,
46-
TError
47-
>['fetchPreviousPage']
48-
refetch: InfiniteQueryObserverResult<TData, TError>['refetch']
49-
remove: InfiniteQueryObserverResult<TData, TError>['remove']
50-
}
5138

5239
export function useInfiniteQuery<
5340
TQueryFnData = unknown,
@@ -104,7 +91,7 @@ export function useInfiniteQuery<
10491
arg1,
10592
arg2,
10693
arg3,
107-
) as InfiniteQueryReturnType<TData, TError>
94+
) as UseInfiniteQueryReturnType<TData, TError>
10895

10996
return result
11097
}

packages/vue-query/src/useQuery.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,25 @@
11
import { QueryObserver } from '@tanstack/query-core'
22
import { useBaseQuery } from './useBaseQuery'
3-
import type { ToRefs } from 'vue-demi'
43
import type {
54
DefinedQueryObserverResult,
65
QueryFunction,
76
QueryKey,
8-
QueryObserverResult,
97
} from '@tanstack/query-core'
108
import type { UseQueryReturnType as UQRT } from './useBaseQuery'
119
import type {
1210
DeepUnwrapRef,
13-
DistributiveOmit,
1411
MaybeRef,
1512
VueQueryObserverOptions,
1613
WithQueryClientKey,
1714
} from './types'
1815

19-
export type UseQueryReturnType<TData, TError> = DistributiveOmit<
20-
UQRT<TData, TError>,
21-
'refetch' | 'remove'
22-
> & {
23-
refetch: QueryObserverResult<TData, TError>['refetch']
24-
remove: QueryObserverResult<TData, TError>['remove']
25-
}
16+
export type UseQueryReturnType<TData, TError> = UQRT<TData, TError>
2617

27-
export type UseQueryDefinedReturnType<TData, TError> = DistributiveOmit<
28-
ToRefs<Readonly<DefinedQueryObserverResult<TData, TError>>>,
29-
'refetch' | 'remove'
30-
> & {
31-
suspense: () => Promise<QueryObserverResult<TData, TError>>
32-
refetch: QueryObserverResult<TData, TError>['refetch']
33-
remove: QueryObserverResult<TData, TError>['remove']
34-
}
18+
export type UseQueryDefinedReturnType<TData, TError> = UQRT<
19+
TData,
20+
TError,
21+
DefinedQueryObserverResult<TData, TError>
22+
>
3523

3624
export type UseQueryOptions<
3725
TQueryFnData = unknown,

scripts/config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ export const packages: Package[] = [
7777
},
7878
]
7979

80-
export const latestBranch = 'main'
81-
8280
export const branchConfigs: Record<string, BranchConfig> = {
8381
main: {
8482
prerelease: false,
@@ -95,6 +93,10 @@ export const branchConfigs: Record<string, BranchConfig> = {
9593
rc: {
9694
prerelease: true,
9795
},
96+
v4: {
97+
prerelease: false,
98+
previousVersion: true,
99+
},
98100
}
99101

100102
export const rootDir = path.resolve(__dirname, '..')

scripts/publish.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import log from 'git-log-parser'
1010
import streamToArray from 'stream-to-array'
1111
import axios from 'axios'
1212
import { DateTime } from 'luxon'
13-
import { branchConfigs, latestBranch, packages, rootDir } from './config'
14-
import type { BranchConfig, Commit, Package } from './types'
13+
import { branchConfigs, packages, rootDir } from './config'
14+
import type { BranchConfig, Commit } from './types'
1515

1616
import type { PackageJson } from 'type-fest'
1717

@@ -22,8 +22,10 @@ async function run() {
2222
process.env.BRANCH ??
2323
// (process.env.PR_NUMBER ? `pr-${process.env.PR_NUMBER}` : currentGitBranch())
2424
currentGitBranch()
25+
const branchConfig: BranchConfig | undefined = branchConfigs[branchName]
2526

2627
const isMainBranch = branchName === 'main'
28+
const isPreviousRelease = branchConfig?.previousVersion
2729
const npmTag = isMainBranch ? 'latest' : branchName
2830

2931
// Get tags
@@ -33,6 +35,10 @@ async function run() {
3335
tags = tags
3436
.filter((tag) => semver.valid(tag))
3537
.filter((tag) => {
38+
// If this is an older release, filter to only include that version
39+
if (isPreviousRelease) {
40+
return tag.startsWith(branchName)
41+
}
3642
if (semver.prerelease(tag) === null) {
3743
return isMainBranch
3844
} else {
@@ -286,8 +292,6 @@ async function run() {
286292
recommendedReleaseLevel = 0
287293
}
288294

289-
const branchConfig: BranchConfig | undefined = branchConfigs[branchName]
290-
291295
if (!branchConfig) {
292296
console.log(`No publish config found for branch: ${branchName}`)
293297
console.log('Exiting...')
@@ -367,15 +371,14 @@ async function run() {
367371
}
368372

369373
console.info()
370-
console.info(`Publishing all packages to npm with tag "${npmTag}"`)
374+
console.info(`Publishing all packages to npm`)
371375

372376
// Publish each package
373377
changedPackages.forEach((pkg) => {
374378
const packageDir = path.join(rootDir, 'packages', pkg.packageDir)
375-
const cmd = `cd ${packageDir} && pnpm publish --tag ${npmTag} --access=public --no-git-checks`
376-
console.info(
377-
` Publishing ${pkg.name}@${version} to npm with tag "${npmTag}"...`,
378-
)
379+
const tagParam = branchConfig.previousVersion ? `` : `--tag ${npmTag}`
380+
const cmd = `cd ${packageDir} && pnpm publish ${tagParam} --access=public --no-git-checks`
381+
console.info(` Publishing ${pkg.name}@${version} to npm "${tagParam}"...`)
379382
execSync(cmd, {
380383
stdio: [process.stdin, process.stdout, process.stderr],
381384
})
@@ -405,7 +408,7 @@ async function run() {
405408
// Stringify the markdown to excape any quotes
406409
execSync(
407410
`gh release create v${version} ${
408-
!isMainBranch ? '--prerelease' : ''
411+
branchConfig.prerelease ? '--prerelease' : ''
409412
} --notes '${changelogMd.replace(/'/g, '"')}'`,
410413
)
411414
console.info(` Github release created.`)

scripts/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ export type Package = {
4343

4444
export type BranchConfig = {
4545
prerelease: boolean
46+
previousVersion?: boolean
4647
}

0 commit comments

Comments
 (0)