💥 Breaking Changes
- Upgrade to React Query v3: #2101
In _app.tsx
// _app.tsx
ErrorFallbackProps,
+ useQueryErrorResetBoundary,
} from "blitz"
-import {queryCache} from "react-query"
...
- onReset={() => {
- // This ensures the Blitz useQuery hooks will automatically refetch
- // data any time you reset the error boundary
- queryCache.resetErrorBoundaries()
- }}
+ onReset={useQueryErrorResetBoundary().reset}
Uses of useInfiniteQuery
- const [groupedProducts, {isFetching, isFetchingMore, fetchMore, canFetchMore}] = useInfiniteQuery(
+ const [groupedProducts, {isFetching, isFetchingNextPage, fetchNextPage, hasNextPage}] = useInfiniteQuery(
getProducts,
(page = {take: 3, skip: 0}) => page,
{
- getFetchMore: (lastGroup) => lastGroup.nextPage,
+ getNextPageParam: (lastGroup) => lastGroup.nextPage,
},
)
In test/utils.tsx
-import {RouterContext, BlitzRouter} from "blitz"
+import {RouterContext, BlitzRouter, BlitzProvider} from "blitz"
...
export function render(/*...*/) {
+<BlitzProvider>
<RouterContext.Provider value={{...mockRouter, ...router}}>{children}</RouterContext.Provider>
+</BlitzProvider>
...
export function renderHook(/*...*/) {
+<BlitzProvider>
<RouterContext.Provider value={{...mockRouter, ...router}}>{children}</RouterContext.Provider>
+</BlitzProvider>
If you were previously importing and using queryCache
from react-query
directly:
-import {queryCache} from "react-query"
+import {queryClient} from "blitz"
-queryCache.clear()
+queryClient.clear()
🚀 New Features
- Ability to prefetch queries on the server
- Read the docs
- This API is not elegant, but we'll improve it
🐞 Patches
⚡️ Changes to the New App Template
👩🍳 Recipes
Internal Meta Changes
- added @andrearizzello as contributor: cc7c72d
- Update findModuleExportsExpressions installer transform utility: #2155
- Update Emotion recipe to better leverage the installer package: #2156
- Switch to using @blitz/installer helper functions …: #2164
- fix ultra scripts so they work on Windows: #2154
- updated @konradkalemba contributions: 1d4695a
- updated @tundera contributions: 563720b
- updated @tundera contributions: af53933
Credits
Huge thanks to @tundera, @JuanM04, @sakulstra, @Roesh, @MrLeebo, @wKovacs64, and @kevinlangleyjr for helping!