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

Fix Next 13.2 compatibility #4108

Merged
merged 4 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/fast-pans-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@blitzjs/next": minor
---

Fix Next 13.2 compatibility

This updates the suspense patch to work with Next.js 13.2+. Hopefully soon we can stop patching once Next.js catches up with all the other frameworks and properly [exposes the `onRecoverableError` react hook](https://github.com/vercel/next.js/discussions/36641).
2 changes: 1 addition & 1 deletion apps/next13/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@tanstack/react-query": "4.0.10",
"blitz": "workspace:*",
"flatted": "3.2.7",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "^4.5.0",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/toolkit-app-passportjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"next": "13.1.6",
"next": "13.2.4",
"openid-client": "5.2.1",
"prisma": "4.6.1",
"react": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/toolkit-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"next": "13.1.6",
"next": "13.2.4",
"next-auth": "4.18.7",
"prisma": "4.6.1",
"react": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"blitz": "workspace:*",
"jest": "29.3.0",
"jest-environment-jsdom": "29.3.0",
"next": "13.1.6",
"next": "13.2.4",
"passport-mock-strategy": "2.0.0",
"passport-twitter": "1.0.4",
"prisma": "4.6.1",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/auth-with-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"delay": "5.0.0",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/auth-with-rpc/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const runTests = () => {
await waitFor(250)
text = await browser.elementByCss("#page").text()
expect(text).toBe("Custom plugin Session Created")
await waitFor(2000)
await waitFor(3000)
text = await browser.elementByCss("#page").text()
expect(text).toBe("Custom plugin RPC Error")
if (browser) {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"lowdb": "3.0.0",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/get-initial-props/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"lowdb": "3.0.0",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.23",
"next": "13.1.6",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/next-13-app-dir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"lowdb": "3.0.0",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/no-suspense/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"lowdb": "3.0.0",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/qm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@prisma/client": "4.6.1",
"@tanstack/react-query": "4.0.10",
"blitz": "workspace:2.0.0-beta.23",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/react-query-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"lowdb": "3.0.0",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/rpc-path-root/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.23",
"next": "13.1.6",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@blitzjs/next": "workspace:2.0.0-beta.23",
"@blitzjs/rpc": "workspace:2.0.0-beta.23",
"blitz": "workspace:2.0.0-beta.23",
"next": "13.1.6",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/trailing-slash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.23",
"lowdb": "3.0.0",
"next": "13.1.6",
"next": "13.2.4",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"husky": "8.0.2",
"jsdom": "^19.0.0",
"lint-staged": "13.0.3",
"next": "13.1.6",
"next": "13.2.4",
"only-allow": "1.1.0",
"prettier": "^2.7.1",
"prettier-plugin-prisma": "4.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/blitz-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@types/react": "18.0.25",
"@types/react-dom": "17.0.14",
"blitz": "2.0.0-beta.23",
"next": "13.1.6",
"next": "13.2.4",
"next-auth": "4.18.7",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/blitz-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"blitz": "2.0.0-beta.23",
"cross-spawn": "7.0.3",
"find-up": "4.1.0",
"next": "13.1.6",
"next": "13.2.4",
"next-router-mock": "0.9.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/blitz-next/src/index-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {IncomingMessage, ServerResponse} from "http"
import {withSuperJsonProps} from "./superjson"
import {ParsedUrlQuery} from "querystring"
import {PreviewData} from "next/types"
import {resolveHref} from "next/dist/shared/lib/router/router"
import {resolveHref} from "next/dist/shared/lib/router/utils/resolve-href"
import {RouteUrlObject, isRouteUrlObject} from "blitz"

export * from "./index-browser"
Expand Down
2 changes: 1 addition & 1 deletion packages/blitz-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/react": "18.0.25",
"@types/react-dom": "17.0.14",
"blitz": "2.0.0-beta.23",
"next": "13.1.6",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "^4.8.4",
Expand Down
9 changes: 9 additions & 0 deletions packages/blitz/src/cli/utils/codegen-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ export const codegenTasks = async () => {
)
await fs.writeFile(nextClientIndex, updatedFile)
log.success("Next.js was successfully patched with a React Suspense fix")
} else if (nextVersion && semver.satisfies(nextVersion, ">=13.2")) {
const updatedFile = readFile
.toString()
.replace(
/_onRecoverableError\.default/,
`(err) => (err.toString().includes("DYNAMIC_SERVER_USAGE") || err.toString().includes("could not finish this Suspense boundary") || err.toString().includes("Minified React error #419")) ? null : _onRecoverableError.default(err)`,
)
await fs.writeFile(nextClientIndex, updatedFile)
log.success("Next.js was successfully patched with a React Suspense fix")
}
} catch (err) {
log.error(JSON.stringify(err, null, 2))
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/templates/app/package.js.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "4.6.1",
"blitz": "latest",
"next": "13.1",
"next": "13.2",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/templates/app/package.ts.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "4.6.1",
"blitz": "latest",
"next": "13.1",
"next": "13.2",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/templates/minimalapp/package.js.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@blitzjs/next": "latest",
"blitz": "latest",
"next": "13.1",
"next": "13.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"ts-node": "10.9.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/templates/minimalapp/package.ts.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@blitzjs/next": "latest",
"blitz": "latest",
"next": "13.1",
"next": "13.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"ts-node": "10.9.1"
Expand Down
Loading