0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-16 22:50:20 +00:00
Commit graph

5,005 commits

Author SHA1 Message Date
lironezra
16783feed1
docs: infinite scroll example uses react-intersection-observer (#3410) 2022-03-16 20:31:32 +01:00
Liam Tait
c6594df791
refactor(devtools): add types to Explorer (#2949)
* refactor(devtools): add types to Explorer

Add types to Explorer component with as minimal functional changes as
possible while still getting type safety

2742

* remove unused set param from explorer toggle

* Wrap Explorer toggle with useCallback

* Rename Explorer toggle to toggleExpanded

* Remove unused path

* Move subEntryPages definition next to usage

* Set type to be a string instead of string union

* Remove unused depth prop

* Move chunkArrays to own tested function

* set handleEntry as required

* Add LabelButton for accesibility

* fix test

* Remove shadowing

* Set subEntries as empty array by default

* Add type for property

* Convert handleEntry function to react component with entry props

* Use unknown for value

* Set RenderProps to required where possible

* Add required attributes to Explorer tests
2022-03-15 13:02:54 +01:00
Binaya Chaudhary
69cc49b7c5
docs: update gitpod link in contributing.md (#3376) 2022-03-13 09:15:48 +01:00
Ken Huh
feb8eb822a
docs: fix a typo in mutations.md (#3386) 2022-03-13 07:32:38 +01:00
ASchwad
7be6d89d68
docs: Extend simple example to handle failed request (#3322) 2022-03-03 20:28:40 +01:00
Eugene Dzhumak
3e8f499aba
docs: update rtk-query comparison.md (#3328)
rtk-query stars counter points to an archived repo.

Query now lives in the main repo as a package.

I understand that this isn't totally right, but at least it seems reasonable not to count start of an archived repo.
2022-02-25 19:59:11 +01:00
Dominik Dorfmeister
b44c213b39
fix(useQuery): pass query as second parameter to useErrorBoundary function(#2660) v3.34.16 2022-02-20 14:09:43 +01:00
Ikko Ashimine
eb4e863cf4
docs: Update CONTRIBUTING.md (#3299)
Github -> GitHub
github -> GitHub
2022-02-14 15:24:59 +01:00
allcontributors[bot]
e8338f92cd
docs: add zrwsk as a contributor for doc (#3297)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-02-14 10:55:00 +01:00
meskill
21fa86d21d
docs: add caveats about memory to ssr.md (#3290)
* docs: add caveats about memory to ssr.md

* revert style changes

* Update docs/src/pages/guides/ssr.md

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>

* Update docs/src/pages/guides/ssr.md

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2022-02-13 20:41:34 +01:00
Jakub Żurawski
f2bfc69285
docs(mutations): describe difference between using callbacks in useMu… (#3274)
* docs(mutations): describe difference between using callbacks in useMutation and .mutate

* Text corrections

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>

* add subheader

* update consecutive mutations case to better describe ordering of mutation calls and fulfillment

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2022-02-13 20:39:32 +01:00
Andrii Artemenko
9b5d18cd47
fix(devtools): add code element's background (#3287) v3.34.15
Prevent code element's backround from being overwritten
2022-02-12 20:15:33 +01:00
flash548
e3df8b1841
docs: Update useQuery.md (#3281)
was missing the placeholderData field on the `useQuery` options signature... but its listed in detail on the latter part of the page.
2022-02-12 18:49:02 +01:00
Tommy Tan
d8c46ce30a
docs: update testing.md (#3278)
fixes sentence by removing "our".
2022-02-08 22:43:35 +01:00
Ville Saukkonen
6d6d9d06cd
docs(setQueriesData): Make setQueriesData more searchable (#3244)
* docs(setQueriesData): Make setQueriesData more searchable

- Makes setQueriesData more searchable
- Change mention of fuzzily matching to partial matching since fuzzy matching is more arbitrary algorithm
- Mention setQueriesData in setQueryData to avoid confusion of behaviours

The purpose of this change is to make setQueriesData a bit more searchable from the docs to avoid confusion like this: https://github.com/tannerlinsley/react-query/discussions/3239

* Apply suggestions from code review

Co-authored-by: Ville Saukkonen <villesau@users.noreply.github.com>

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2022-02-06 15:09:21 +01:00
Dominik Dorfmeister
b38eed6326 chore: fix prettier v3.34.14 2022-02-06 09:47:24 +01:00
Arty
a470f4601b
fix(types): useQueries to also handle array-params with typed QueryKey (#3267)
* fix(types): handle useQueries wrappers with strongly-typed array parameters

* test(types): confirm typecheck passes without explicit type for mapped query

* test(types): add typecheck on queryFn in mapped query
2022-02-06 09:33:59 +01:00
Arnaud
efb77d7c40
docs(cancellation): add graphql request v4 example (#3264) 2022-02-05 13:09:21 +01:00
Jeff Sims
a536773b00
fix(types): export QueriesOptions and QueriesResults types for useQueries (#3251) v3.34.13
* refactor(useQueries) export QueriesOptions type

export the QueriesOptions type

closes #3250

* refactor(useQueries): add export to index

Add the export of the QueriesOptions type to the index file

* refactor(useQueries) export QueriesResults type

Export QueriesResults type

Co-authored-by: Jeffrey Sims <jeffreysims@Jeffrey-Sims-Mac.local>
2022-02-05 08:34:37 +01:00
fediev
4dcb490d4d
docs(tests): infinite scroll without click more button (#3247)
On the first rendering, `hasNextPage` is `undefined`, but converted to `true` by the default value.

For intersection observer to trigger correctly without clicking more button, `hasNextPage` needs type casting.
2022-01-30 14:58:28 +01:00
Amen SOUISSI
6710bc1715
fix(types): use MutationKey instead of QueryKey for useIsMutating (#3222) v3.34.12 2022-01-23 16:47:23 +01:00
Dominik Dorfmeister
c532d81313
fix(core): make sure batching finishes if exception is thrown (#3216) v3.34.11
incrementing and decrementing transactions need to happen in an atomic operation, no matter what happens in between; if we increment, but never decrement, we will get to a state where transactions can never become zero - we're basically "leaking" an open transaction. This leads to no observers being informed ever again because we think we still have an open transaction

this can be fixed by using try/finally to always decrement the transactions
2022-01-21 13:24:22 +01:00
Bennett Dams
f5a0ceceae
docs(ssr): Hydration caveat for Next.js' rewrites (#3209) v3.34.10
Adds a small section for a caveat about hydration when using some specific feature/configuration of Next.js
2022-01-21 13:19:42 +01:00
Arty
11f4ea99c0
fix(useQueries): allow types to work with strongly typed QueryFunction + QueryKey (#3214) 2022-01-21 13:18:28 +01:00
Damian Osipiuk
26b39546cc
fix(types): export QueryClientConfig interface (#3203) v3.34.9 2022-01-21 13:10:11 +01:00
Arnaud
e328ca0bc3
docs(examples): react-native: regenerate yarn.lock (#3197)
Regenerate a clean yarn.lock file without versions issues.
2022-01-16 09:16:17 +01:00
Arnaud
56e3ba7a9c
docs(examples): react-native: update .gitignore to exclude lib folder (#3196) 2022-01-14 14:06:50 +01:00
Arnaud
6722d06d22
docs(examples): react-native basic app in typescript (#3174)
* examples: react-native

Same example as in the Expo snack but in Typescript

* docs(examples): react-native: add link to the typescript version in the repo

* fix: use proper type for onAppStateChange
2022-01-14 09:16:34 +01:00
Dominik Dorfmeister
755702dd78
fix(queryObserver): fix data stability (#3183) v3.34.8
by making sure to memoize the structurally shared version of data rather than the raw one
2022-01-12 14:53:10 +01:00
maricabertarini
d4c6798edf
docs(examples/load-more-infinite-scroll): fix wrong condition (#3175) 2022-01-11 20:40:53 +01:00
Scott Davis
02f681d6ae
docs(useMutation): clarify retry default value (#3159)
This makes the default value more apparent and adds `retry` and `retryDelay` to the example code.
2022-01-05 18:42:55 +01:00
allcontributors[bot]
98fbec5896
docs: add arnaudbzn as a contributor for code, doc (#3157)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-01-04 22:25:40 +01:00
Arnaud
d779df14e9
docs(examples): add react native expo snack example (#3156) 2022-01-04 22:15:51 +01:00
Dominik Dorfmeister
d12d0cf5bc
chore: issue template (#3154) 2022-01-02 12:44:19 +01:00
Dmitriy Fishman
f4eb19421c
docs: Fix a typo in tkdodos-blog.md (#3152) 2021-12-31 11:29:15 +01:00
DidrikLind
93824ec731
refactor(examples): use triple equal instead of double equal (#3135) 2021-12-28 22:12:04 +01:00
Dominik Dorfmeister
d7faf86005
fix(queryObserver): memoized select functions should not return outdated values (#3140) v3.34.7
not all runs to createResult are saved on `this.currentResult` (optimistically created updates do not - we just create the result again later). With the fix from #3098, we made sure that memoized select does not run again in those cases by storing every run. However, that now means that we cannot rely on `prevResult.data` because it might still contain outdated data.

The solution is to store a pair of previous selectFn + data and return the exact data that was computed from the previous select fn if we get the exact same function passed
2021-12-28 18:34:17 +01:00
Damian Osipiuk
b977cf4ddd
refactor(types): use core types in useMutation instead of redefining them (#3122) 2021-12-23 10:13:10 +01:00
Marco Pasqualetti
ca2a57aa4e
fix(devtools): code color is not inherited from panel color (#3115) v3.34.6 2021-12-23 10:07:53 +01:00
Dominik Dorfmeister
3981f5219a
fix(query): set error to null when going to loading state (#3106) v3.34.5
to be aligned with the types, as `loading` cannot have an `error` set.
2021-12-17 12:54:54 +01:00
Dominik Dorfmeister
2054f5b227
fix(queryObserver): make sure that memoized select function only runs once per input (#3098) v3.34.4
we compute the result optimistically, and then one more time when calling setOptions. Both times run the select function because only setOptions will update the previous result and previous options. storing the "previous" selectFn separately on the observer whenever it was invoked (independent of the fact from where it was called) side-steps the issue
2021-12-15 19:52:32 +01:00
François Robichet
f9077bcb2c
docs: Add cacheTime default (#3094) 2021-12-14 20:05:53 +01:00
Dominik Dorfmeister
128e578c08
fix: unsubscribe correctly in onlineManager and focusManager (#3092) v3.34.3 2021-12-14 13:08:19 +01:00
Jbee
078114254d
fix(core): remove enabled condition in queryObserver for suspense (#3093)
* fix(core): remove enabled condition in queryObserver

https://github.com/tannerlinsley/react-query/issues/2434

* chore: add missing test case

* chore: fix format
2021-12-14 13:07:29 +01:00
Clifford Fajardo
988ba10a71
chore: update bug report template (#3089) 2021-12-13 07:16:57 +01:00
Dominik Dorfmeister
ca335dec7b
fix(useInfiniteQuery): fix infinite re-renders when select produced a new result (#3081) v3.34.2
* fix(useInfiniteQuery): fix infinite re-renders when select produced a new result

by correctly forwarding notifyOptions

* fix(useInfiniteQuery): fix suspense test

asserting the length of 3 seems wrong here and was likely only necessary because we triggered one too many re-renders before this fix :)
2021-12-10 13:47:00 +01:00
Hyeonsu Lee
0f00cda954
docs: Make react-native example up-to-date #3057 2021-12-10 13:14:30 +01:00
Clement Bowe
e4da8dd10b
docs: Update does-this-replace-client-state.md (#3070) v3.34.1
changed "any boilerplate code that use"  to boilerplate code that was used" to improve the clarity of the sentence.
2021-12-09 20:37:16 +01:00
allcontributors[bot]
ebf1e68a52
docs: add jvuoti as a contributor for code (#3053)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2021-12-04 22:57:25 +01:00
Janne Vuoti
2ec1979f9c
fix(queriesObserver): fix getOptimisticResult, order of returned observers (#3052)
* fix(queriesObserver): fix getOptimisticResult call

Fix queriesObserver to call getOptimisticResult as before.
This was a bug introduced in PR #2866

* fix(queriesObserver): return observers in same order as queries

Sort returned observer entries to match the order of queries.
Previously, with keepPreviousData: true, the repurposed observers
would be returned last, potentially in different order than the queries.
2021-12-04 22:56:37 +01:00