Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update comparison.md #920

Closed
wants to merge 1 commit into from
Closed

Update comparison.md #920

wants to merge 1 commit into from

Conversation

shuding
Copy link

@shuding shuding commented Aug 24, 2020

This part is not true:

SWR uses component styling/visibility to only prefetch the next page and does not provide the capability to "lag" previous query results while new ones load without much non-trivial hackery.

SWR has a pagination API that supports the capability (docs). "component styling/visibility" is just a code pattern and it's never required by SWR.

@vercel
Copy link

vercel bot commented Aug 24, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/1pu6fedw3
✅ Preview: https://react-query-git-fork-shuding-patch-1.tannerlinsley.vercel.app

@tannerlinsley
Copy link
Collaborator

I believe the docs are still very accurate. It's important to understand that paginated or "lagged" queries are not the same as infinite queries. You can clearly see that there is a ✅ next to Infinite Queries for SWR as per your documentation link. As far as I know, SWR does not have the capability to lag query results in either the useSWR or useSWRInfinite hooks.

@shuding
Copy link
Author

shuding commented Aug 26, 2020

If that's your definition, you should rename "Paginated Queries" to "Lagged Queries". Otherwise it will be misleading and people will think that SWR doesn't support pagination at all. It's not necessary to have that "lagged data" for pagination. I probably want to see the loading screen of the next page immediately.

@shuding shuding closed this Aug 26, 2020
@shuding shuding deleted the patch-1 branch August 26, 2020 09:43
@tannerlinsley
Copy link
Collaborator

We can for sure talk about a better name. Lagged queries isn’t half bad actually. Regardless of the name, I wouldn’t down play the functionality. That very type of UX is what is inspiring and driving Suspense and CM (but for an entire app). Its always better not to clobber data UI to show a loader when it’s avoidable.

@styfle
Copy link

styfle commented Sep 2, 2020

Why not use something like:

✅ Paginated Queries1

Then its clear it supports Paginated Queries but the description below could mention the lagged queries?

tannerlinsley added a commit that referenced this pull request Sep 2, 2020
@tannerlinsley
Copy link
Collaborator

I've updated the docs to reflect that SWR is capable of pagination (which is really just being able to change the query key to reflect a specific page), and added an additional row for "Lagged Queries" and an explanation behind it. This further revealed that Apollo also does not have the capability for lagged queries and also that lagged queries apply to infinitely loaded queries as well. So win win!

The important thing to note here (for posterity) is that query lagging essentially gives the same user experience as suspense will in the future. It allows you to persist your current view while the next view loads without the jarring experience of seeing a loading state. Of course, this is partially avoidable via prefetching, but obviously you wouldn't want to disable a button to load the next page until it's been prefetched. Hence, the awesomeness of this feature.

Thanks @styfle and @shuding!

@tannerlinsley
Copy link
Collaborator

🎉 This issue has been resolved in version 2.14.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

ryands17 added a commit to ryands17/react-query that referenced this pull request Sep 21, 2020
* docs: added more detailed explanation of what the cache timeout does in the detailed walkthough of useQuery (TanStack#928)

Co-authored-by: Clayton Marshall <claytn@claytons-mbp.lan>

* Update index.js

* Add queryCache de/rehydration (TanStack#728)

* chore(hydration): set up separate hydration entry point

* feat(hydration): add support for de/rehydrating queryCaches

- Add dehydrate(queryCache, config)
- Add hydrate(queryCache, dehydratedQueries, config)
- Add useHydrate(dehydratedQueries, config)

* test(hydration): fix broken type in test

* rename scheduleTimeoutsManually to activateTimeoutsManually

* docs(hydration): add API-docs for hydration and update comparison

* docs(ssr): update ssr-docs with new approach based on de/rehydration

* remove activateTimeoutsManually

* add default shouldDehydrate

* add hydration/ReactQueryCacheProvider

* use unknown for initialData in dehydration

* rename initialQueries  and dehydratedQueries to dehydratedState

* include queryKey instead of queryHash in dehydration

* update initialQueries to dehydratedState in ssr guide docs

* remove shouldHydrate-option

* feat: determine staleness locally instead of globally (TanStack#933)

* fix: add hydration.js to npm files

* fix: add hydration.js to npm files

* fix: make sure initial data is used when switching queries (TanStack#944)

* feat: change ReactQueryCacheProvider from hydration to Hydrate (TanStack#943)

* tests: fix setTimeout for ci tests

* fix: always use config from last query execution (TanStack#942)

* fix: make sure queries with only inactive observers are also invalidated (TanStack#949)

* feat: add notifyOnStatusChange flag (TanStack#840)

* docs: update comparison

Closes TanStack#920

* docs: update supporters and comparison

* docs: fix sponsors rendering

* fix: ignore errors from background fetches (TanStack#953)

* feat: add forceFetchOnMount flag (TanStack#954)

* feat: add isPreviousData and isFetchedAfterMount flags (TanStack#961)

* docs(react-native): add solution for fullscreen error (TanStack#958)

* docs: update sponsors

* fix: use hook config on refocus or reconnect (TanStack#964)

* docs: typo in useQuery.test (TanStack#965)

* fix: make sure setQueryData is not considered as initial data (TanStack#966)

* refactor: cleanup to reduce file size and add tests (TanStack#969)

* Update devtools.md (TanStack#973)

Separate the sentences based on contex

* fix: export hydration types (TanStack#974)

* docs: update sponsors

* fix(hydration): overwrite the existing data in the cache if hydrated data is newer (TanStack#976)

* refactor: optimize render path and improve type safety (TanStack#984)

* feat: add reset error boundary component (TanStack#980)

* refactor: remove unused deepEqual function (TanStack#999)

* fix: cancel current fetch when fetching more (TanStack#1000)

* fix: notify query cache on stale (TanStack#1001)

* test: add previous data test (TanStack#1003)

* feat: add support for tree shaking (TanStack#994)

* fix: useInfinityQuery fetchMore should not throw (TanStack#1004)

* docs: update api docs (TanStack#1005)

* refactor: remove query status bools (TanStack#1009)

* fix: make sure initial data always uses initial stale (TanStack#1010)

* feat: add always option to refetch options (TanStack#1011)

* feat: export QueryCache and remove global query cache from docs and examples (TanStack#1017)

* docs: remove shared config (TanStack#1021)

* feat: add remove method and deprecate clear (TanStack#1022)

* fix: should be able to invalidate queries (TanStack#1006)

* fix: should throw error when using useErrorBoundary (TanStack#1016)

* docs: Add graphql docs

* docs: add graphql-request example

* docs: update graphql docs

* docs: add graphql example

* feat: implement batch rendering (TanStack#989)

* docs: Update comparison.md

* docs: Update essentials banner

* docs: reorder homepage

* fix: accept any promise in useMutation callbacks (TanStack#1033)

* docs: prefer default config of QueryCache (TanStack#1034)

* fix: include config callbacks in batch render (TanStack#1036)

* docs: update example deps

* docs: fix comparison 3rd party website links (TanStack#1040)

* Remove storing the return value of queryCache.removeQueries (TanStack#1038)

Removed storing the return value of `queryCache.removeQueries` as it doesn't return anything.

* feat: add QueryCache.fetchQuery method (TanStack#1041)

* docs: add refetch documentation (TanStack#1043)

* docs: fix graphql example link

Closes TanStack#1044

* docs: remove trailing quotes from supporters links (TanStack#1045)

The quotes were breaking the links.

* docs: fix typo in queries page (TanStack#1046)

* fix: prevent bundlers from removing side effects (TanStack#1048)

* test: add invalidate query tests (TanStack#1052)

* fix: query should try and throw again after error boundary reset (TanStack#1054)

* docs: fix `user.id` access in case user is null (TanStack#1056)

* docs: update comparison

* docs: update sponsors

* feat: add QueryCache.watchQuery (TanStack#1058)

* docs: Update invalidations-from-mutations.md (TanStack#1057)

Remove unnecessary parenthesis

Co-authored-by: Clayton Marshall <c.marshall@salesforce.com>
Co-authored-by: Clayton Marshall <claytn@claytons-mbp.lan>
Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
Co-authored-by: Fredrik Höglund <fredrik.hoglund@gmail.com>
Co-authored-by: Niek Bosch <just.niek@gmail.com>
Co-authored-by: Dragoș Străinu <str.dr4605@gmail.com>
Co-authored-by: Alex Marshall <alex.k.marshall83@gmail.com>
Co-authored-by: Rudzainy Rahman <rudzainy@gmail.com>
Co-authored-by: Corentin Leruth <corentin.leruth@gmail.com>
Co-authored-by: Evgeniy Boreyko <boreykojenya@yandex.ru>
Co-authored-by: Pierre Mdawar <pierre@mdawar.dev>
Co-authored-by: Juliano Farias <thefrontendwizard@gmail.com>
Co-authored-by: Twinkle <saintwinkle@gmail.com>
Co-authored-by: Julius-Rapp <61518032+Julius-Rapp@users.noreply.github.com>
Co-authored-by: cheddar <chad@cmfolio.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants