Skip to content

Commit

Permalink
Merge branch 'canary' of github.com:vercel/next.js into update-swr-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpolitov committed Jan 12, 2023
2 parents db8132b + 0b36a52 commit 32140e3
Show file tree
Hide file tree
Showing 26 changed files with 24,388 additions and 41 deletions.
3 changes: 2 additions & 1 deletion examples/app-dir-i18n-routing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"negotiator": "0.6.3",
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"server-only": "0.0.1"
},
"devDependencies": {
"@types/negotiator": "0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "13.1.2-canary.5"
"version": "13.1.2-canary.6"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
"directory": "packages/eslint-config-next"
},
"dependencies": {
"@next/eslint-plugin-next": "13.1.2-canary.5",
"@next/eslint-plugin-next": "13.1.2-canary.6",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.0",
"eslint-import-resolver-node": "^0.3.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"description": "ESLint plugin for NextJS.",
"main": "dist/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/font/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/font",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"repository": {
"url": "vercel/next.js",
"directory": "packages/font"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"main": "index.js",
"types": "index.d.ts",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"private": true,
"scripts": {
"build-native": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi --features plugin,rustls-tls --js false native",
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -76,7 +76,7 @@
]
},
"dependencies": {
"@next/env": "13.1.2-canary.5",
"@next/env": "13.1.2-canary.6",
"@swc/helpers": "0.4.14",
"caniuse-lite": "^1.0.30001406",
"postcss": "8.4.14",
Expand Down Expand Up @@ -126,11 +126,11 @@
"@hapi/accept": "5.0.2",
"@napi-rs/cli": "2.13.3",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "13.1.2-canary.5",
"@next/polyfill-nomodule": "13.1.2-canary.5",
"@next/react-dev-overlay": "13.1.2-canary.5",
"@next/react-refresh-utils": "13.1.2-canary.5",
"@next/swc": "13.1.2-canary.5",
"@next/polyfill-module": "13.1.2-canary.6",
"@next/polyfill-nomodule": "13.1.2-canary.6",
"@next/react-dev-overlay": "13.1.2-canary.6",
"@next/react-refresh-utils": "13.1.2-canary.6",
"@next/swc": "13.1.2-canary.6",
"@segment/ajv-human-errors": "2.1.2",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
Expand Down
9 changes: 1 addition & 8 deletions packages/next/src/client/components/layout-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ export function InnerLayoutRouter({
// TODO-APP: implement `<Offscreen>` when available.
// isActive,
path,
rootLayoutIncluded,
}: {
parallelRouterKey: string
url: string
Expand All @@ -167,7 +166,6 @@ export function InnerLayoutRouter({
tree: FlightRouterState
isActive: boolean
path: string
rootLayoutIncluded: boolean
}) {
const context = useContext(GlobalLayoutRouterContext)
if (!context) {
Expand Down Expand Up @@ -295,12 +293,10 @@ export function InnerLayoutRouter({
)

// Ensure root layout is not wrapped in a div as the root layout renders `<html>`
return rootLayoutIncluded ? (
return (
<ScrollAndFocusHandler focusAndScrollRef={focusAndScrollRef}>
{subtree}
</ScrollAndFocusHandler>
) : (
subtree
)
}

Expand Down Expand Up @@ -455,7 +451,6 @@ export default function OuterLayoutRouter({
template,
notFound,
notFoundStyles,
rootLayoutIncluded,
}: {
parallelRouterKey: string
segmentPath: FlightSegmentPath
Expand All @@ -469,7 +464,6 @@ export default function OuterLayoutRouter({
hasLoading: boolean
notFound: React.ReactNode | undefined
notFoundStyles: React.ReactNode | undefined
rootLayoutIncluded: boolean
}) {
const context = useContext(LayoutRouterContext)
if (!context) {
Expand Down Expand Up @@ -546,7 +540,6 @@ export default function OuterLayoutRouter({
segmentPath={segmentPath}
path={preservedSegment}
isActive={currentChildSegment === preservedSegment}
rootLayoutIncluded={rootLayoutIncluded}
/>
</RedirectBoundary>
</NotFoundBoundary>
Expand Down
9 changes: 9 additions & 0 deletions packages/next/src/client/components/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,11 @@ function clientReducer(
// Handles case where prefetch only returns the router tree patch without rendered components.
if (subTreeData !== null) {
if (flightDataPath.length === 3) {
cache.status = CacheStates.READY
cache.subTreeData = subTreeData
fillLazyItemsTillLeafWithHead(cache, state.cache, treePatch, head)
} else {
cache.status = CacheStates.READY
// Copy subTreeData for the root node of the cache.
cache.subTreeData = state.cache.subTreeData
// Create a copy of the existing cache with the subTreeData applied.
Expand All @@ -855,6 +857,7 @@ function clientReducer(
)

if (hardNavigate) {
cache.status = CacheStates.READY
// Copy subTreeData for the root node of the cache.
cache.subTreeData = state.cache.subTreeData

Expand Down Expand Up @@ -915,6 +918,7 @@ function clientReducer(
)

// Copy subTreeData for the root node of the cache.
cache.status = CacheStates.READY
cache.subTreeData = state.cache.subTreeData

// Copy existing cache nodes as far as possible and fill in `data` property with the started data fetch.
Expand Down Expand Up @@ -1012,10 +1016,12 @@ function clientReducer(
mutable.mpaNavigation = isNavigatingToNewRootLayout(state.tree, newTree)

if (flightDataPath.length === 3) {
cache.status = CacheStates.READY
cache.subTreeData = subTreeData
fillLazyItemsTillLeafWithHead(cache, state.cache, treePatch, head)
} else {
// Copy subTreeData for the root node of the cache.
cache.status = CacheStates.READY
cache.subTreeData = state.cache.subTreeData
// Create a copy of the existing cache with the subTreeData applied.
fillCacheWithNewSubTreeData(cache, state.cache, flightDataPath)
Expand Down Expand Up @@ -1137,10 +1143,12 @@ function clientReducer(

// Root refresh
if (flightDataPath.length === 3) {
cache.status = CacheStates.READY
cache.subTreeData = subTreeData
fillLazyItemsTillLeafWithHead(cache, state.cache, treePatch, head)
} else {
// Copy subTreeData for the root node of the cache.
cache.status = CacheStates.READY
cache.subTreeData = state.cache.subTreeData
fillCacheWithNewSubTreeData(cache, state.cache, flightDataPath)
}
Expand Down Expand Up @@ -1288,6 +1296,7 @@ function clientReducer(
mutable.mpaNavigation = isNavigatingToNewRootLayout(state.tree, newTree)

// Set subTreeData for the root node of the cache.
cache.status = CacheStates.READY
cache.subTreeData = subTreeData
fillLazyItemsTillLeafWithHead(cache, state.cache, treePatch, head)

Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/lib/format-server-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function formatServerError(error: Error): void {
error,
`${error.message}
This might be caused by a React Class component being rendered in a server component, React Class components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component`
This might be caused by a React Class Component being rendered in a Server Component, React Class Components only works in Client Components. Read more: https://nextjs.org/docs/messages/class-component-in-server-component`
)
return
}
Expand Down
2 changes: 0 additions & 2 deletions packages/next/src/server/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,6 @@ export async function renderToHTMLOrFlight(
notFound={NotFound ? <NotFound /> : undefined}
notFoundStyles={notFoundStyles}
childProp={childProp}
rootLayoutIncluded={rootLayoutIncludedAtThisLevelOrAbove}
/>,
]
}
Expand Down Expand Up @@ -1387,7 +1386,6 @@ export async function renderToHTMLOrFlight(
notFound={NotFound ? <NotFound /> : undefined}
notFoundStyles={notFoundStyles}
childProp={childProp}
rootLayoutIncluded={rootLayoutIncludedAtThisLevelOrAbove}
/>,
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "13.1.2-canary.5",
"version": "13.1.2-canary.6",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
Loading

0 comments on commit 32140e3

Please sign in to comment.