Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Checkpoint

* Split to separate files

* Less exports

* Update useQuery

* v1.0.0-alpha.0

* Refactor to queryCache, reorg files

* v1.0.0-alpha.1

* Fixes

* Update main.yml

* Update main.yml

* Update main.yml

* Include Helpers

* v1.0.0-alpha.2

* Clean up deps

* v1.0.0-alpha.3

* Query Cache + tons more and docs

* v1.0.0-alpha.4

* [next] add some tests (TanStack#143)

* add usePaginatedQuery test

* fix setQueryData test

* Update utils.js

Fix TanStack#147

* Update useMutation.js

* Created the queryFnParamsFilter config option for useQuery

* Update README.md

* Update queryCache.js

* Create settings.json

* Fixes

* v1.0.0-alpha.5

* Update Readme and build

* Update README.md

* Update README.md

* Update CHANGELOG.md

* New default for refetchOnMount = true

* Update package.json

* [next] Regression tests (TanStack#148)

* add useQuery ssr test

* add useQuery test

* add test for dependent queries

* add default status test

* add status test in manual mode

* add test

* format test files

* expand dependent queries test

* ignore __tests__/shared folder

* match test files by .test.js filename instead of __test__ folder

* do not cache queries with undefined queryHash

Fixes TanStack#137

* format

* fix typos

* Merge with fixes for regressions

* update size-plugin

* remove size-plugin

Co-authored-by: Tanner Linsley <[email protected]>

* Remove size plugin

* Update useMutation test to not be so noisy.

Co-authored-by: Andrew Cherniavskii <[email protected]>
  • Loading branch information
tannerlinsley and cherniavskii authored Feb 26, 2020
1 parent 5040ea8 commit 5f16a50
Show file tree
Hide file tree
Showing 58 changed files with 8,589 additions and 1,515 deletions.
8 changes: 6 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
[
"@babel/env",
{
"modules": false
"modules": false,
"loose": true,
"exclude": ["@babel/plugin-transform-regenerator"]
}
],
"@babel/react"
Expand All @@ -15,7 +17,9 @@
[
"@babel/env",
{
"modules": "commonjs"
"modules": "commonjs",
"loose": true,
"exclude": ["@babel/plugin-transform-regenerator"]
}
]
]
Expand Down
9 changes: 9 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Browsers we support
> 0.5%
Chrome >= 73
ChromeAndroid >= 75
Firefox >= 67
Edge >= 17
IE 11
Safari >= 12.1
iOS >= 11.3
3 changes: 0 additions & 3 deletions .github/size-plugin.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Compressed Size

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2-beta
with:
fetch-depth: 1
- uses: preactjs/compressed-size-action@v1
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
21 changes: 13 additions & 8 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
{
"dist/index.js": {
"bundled": 31777,
"minified": 16088,
"gzipped": 4619
"bundled": 13805,
"minified": 13734,
"gzipped": 4366
},
"dist/index.es.js": {
"bundled": 31236,
"minified": 15605,
"gzipped": 4517,
"bundled": 13779,
"minified": 13730,
"gzipped": 4300,
"treeshaked": {
"rollup": {
"code": 3329,
"code": 7587,
"import_statements": 21
},
"webpack": {
"code": 9422
"code": 8581
}
}
},
"dist/index.min.js": {
"bundled": 13734,
"minified": 13734,
"gzipped": 4366
}
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#ff4154", // change this color!
"titleBar.inactiveBackground": "#ff4154", // change this color!
"titleBar.activeForeground": "#ffffff", // change this color!
"titleBar.inactiveForeground": "#ffffff" // change this color!
}
}
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Changelog

## 1.0.0

**Features & Enhancements**

- `usePaginatedQuery` - A dedicated hook for window-like querying of paginated data or cursor-driven batches of data
- `useInfiniteQuery` - A dedidated hook for accumulative querying of paginated data or cursor-driven batches of data
- Synchronous Query Cache Reads/Writes/Upserts/Deletes
- Improved query key matching for removing and refetching queries
- External subscriptions to query cache updates
- Unlimited query key length support
- Optional Query Variables
- `onSettled` callback for query and mutation hooks
- `onSuccess` and `onError` callbacks for mutations
- Better SSR support via `config.initialData`
- `config.initialData` now supports passing an initializer function, similar to React.useState
- Query status is now automatically inferred based on `initialData` (`success` for non-`undefined` intitial data, `loading` for `undefined` intitial data)
- Query objects now supply an `updatedAt` property for making better informed decisions about synchronous cache usage
- Overall, less over-fetching out of the box when using multiple instances of a query.
- Added a new `config.refetchOnMount` that defaults to `true` and when set to `false` will disable additional instances of a query to trigger background refetches.
- More reliable suspense support for prefetched queries and background refetching lifecycles
- Support for errorBoundaries out of the box when using Suspense for both queries and mutations
- Added a `globalConfig.queryFnParamsFilter` function that allows filtering the parameters that get sent to the query function.

**Breaking Changes**

- Query Keys and Query functions
- Query keys in array form are no longer limited to a `[String, Object]` tuple, but can have as many serializable items in them as necessary.
- Query functions now receive **all** query key items as parameters (before they only recieved a single variables object if supplied)
- Query functions can now also receive optional query variables (passed as an optional second variable to `useQuery`) as parameters. They are applied after the query key parameters
- `useQuery`
- `paginated` has been removed in favor of the new `usePaginatedQuery` and `useInfiniteQuery` hooks. This includes the following options and methods as well:
- `isFetchingMore`
- `canFetchMore`
- `fetchMore`
- `useMutation`
- `refetchQueries` and `updateQuery` options have been removed in favor of `onSuccess`, `onError` and `onSettled` + `queryCache.refetchQueries` and `queryCache.setQueryData`
- `prefetchQuery` has been removed in favor of `queryCache.prefetchQuery`
- `refetchQuery` has been removed in favor of `queryCache.refetchQueries`
- `refetchAllQueries` has been removed in favor of `queryCache.refetchQueries`
- `updateQuery` has been removed in favor of `queryCache.setQueryData`
- `clearQueryCache` has been removed in favor of `queryCache.clear` and `queryCache.removeQueries`
- When `initialData` now resolves to any non-`undefined` value:
- `status` will be initially set to `success`
- The query will not automatically refetch on mount
- `isStale` will initially be set to `true`, and the standard staleTimeout will be applied

## 0.4.3

- Remove unrelated branch artifacts from dist folder, including types
Expand Down
Loading

0 comments on commit 5f16a50

Please sign in to comment.