github blitz-js/blitz v0.34.0

latest releases: v2.0.8, blitz@2.0.8, @blitzjs/rpc@2.0.8...
3 years ago

💥 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

  • 🎉 Add autogenerated Routes manifest for use with <Link> components: #2042
// You can import `Routes`
import { Link, Routes } from "blitz"

//  And then use it for robust, fully typed links
<Link href={Routes.SignupPage()} />
<Link href={Routes.ProductsPage({ productId: 123 })} />
  • Upgrade our nextjs fork to 10.1.3: #2186
  • Ability to prefetch queries on the server

🐞 Patches

  • Fix query string spaces with useRouterQuery(): #2174
  • Fix shallow routing: #2173
  • Change Blitz to use our nextjs fork (no internal changes besides using our own build): #2122
  • Fix "Failed to load config in getConfig" log message: #2220
  • Fix crash when using Blitz inside iframes: #2219
  • Send anonymous analytics to to blitz collector instead of nextjs: #2224

⚡️ Changes to the New App Template

  • Rename types.d.ts to global.d.ts: #2205
  • Add .editorconfig and .vscode extension recomendations: #2142
  • Upgrade dependencies: #2176
  • Fix husky scripts to use npx for binaries instead of npm run: #2213

Internal Meta Changes

Credits

Huge thanks to @tundera, @Skn0tt, @JuanM04, @sakulstra, @mtford90, @peterpalau, @Roesh, @MrLeebo, @wKovacs64, and @kevinlangleyjr for helping!

Don't miss a new blitz release

NewReleases is sending notifications on new releases.