Skip to content

Commit 3e053ea

Browse files
committed
docs: update comparison for SWR pagination/infinite
1 parent b5d1f0d commit 3e053ea

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docs/src/pages/docs/comparison.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ Feature/Capability Key:
1717
| Supported Protocol | HTTP | HTTP | GraphQL |
1818
| Supported Query Signatures | Promise | Promise | GraphQL Query |
1919
| Supported Query Keys | JSON | JSON | GraphQL Query |
20-
| Query Key Change Detection | Deep Compare (Serialization) | Referential Equality (===) | Deep Compare (Serialization) |
20+
| Query Key Change Detection | Deep Compare (Serialization) | Referential Equality (===) | Deep Compare (Serialization) |
2121
| Bundle Size | [![][bp-react-query]][bpl-react-query] | [![][bp-swr]][bpl-swr] | [![][bp-apollo]][bpl-apollo] |
2222
| Queries ||||
2323
| Caching ||||
2424
| Devtools || 🟡 ||
2525
| Polling/Intervals ||||
2626
| Parallel Queries ||||
2727
| Dependent Queries ||||
28-
| Paginated/Infinite Queries || ✅ +(~2kb) ||
28+
| Paginated Queries || 🛑<sup>1</sup> ||
29+
| Infinite Queries || ✅<sup>2</sup> ||
2930
| Initial Data ||||
3031
| Scroll Recovery ||||
3132
| Cache Manipulation ||||
@@ -34,18 +35,20 @@ Feature/Capability Key:
3435
| Mutation Hooks || 🟡 ||
3536
| Prefetching APIs || 🔶 ||
3637
| Query Cancellation || 🛑 | 🛑 |
37-
| Partial Query Matching<sup>1</sup> || 🛑 | 🛑 |
38+
| Partial Query Matching<sup>2</sup> || 🛑 | 🛑 |
3839
| Window Focus Refetching ||| 🛑 |
3940
| Network Status Refetching | 🛑 |||
40-
| Automatic Refetch after Mutation<sup>2</sup> | 🔶 | 🔶 ||
41+
| Automatic Refetch after Mutation<sup>3</sup> | 🔶 | 🔶 ||
4142
| Cache Dehydration/Rehydration | 🛑 | 🛑 ||
4243
| React Suspense (Experimental) ||| 🛑 |
4344

4445
### Notes
4546

46-
> **<sup>1</sup> Partial query matching** - Because React Query uses deterministic query key serialization, this allows you to manipulate variable groups of queries without having to know each individual query-key that you want to match, eg. you can refetch every query that starts with `todos` in its key, regardless of variables, or you can target specific queries with (or without) variables or nested properties, and even use a filter function to only match queries that pass your specific conditions.
47+
> **<sup>1</sup> Paginated Queries in SWR are not "lazy"** - While React Query provides a way to continue to see an existing pages data while the next page loads, 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.
4748
48-
> **<sup>2</sup> Automatic Refetch after Mutation** - For truly automatic refetching to happen after a mutation occurs, a schema is necessary (like the one graphQL provides) along with heuristics that help the library know how to identify individual entities and entities types in that schema.
49+
> **<sup>2</sup> Partial query matching** - Because React Query uses deterministic query key serialization, this allows you to manipulate variable groups of queries without having to know each individual query-key that you want to match, eg. you can refetch every query that starts with `todos` in its key, regardless of variables, or you can target specific queries with (or without) variables or nested properties, and even use a filter function to only match queries that pass your specific conditions.
50+
51+
> **<sup>3</sup> Automatic Refetch after Mutation** - For truly automatic refetching to happen after a mutation occurs, a schema is necessary (like the one graphQL provides) along with heuristics that help the library know how to identify individual entities and entities types in that schema.
4952
5053
[bp-react-query]: https://badgen.net/bundlephobia/minzip/react-query?label=%20
5154
[bp-swr]: https://badgen.net/bundlephobia/minzip/swr?label=%20

0 commit comments

Comments
 (0)