Skip to content

Commit

Permalink
Merge branch 'move-display-package' of https://github.com/blitz-js/blitz
Browse files Browse the repository at this point in the history
 into move-display-package
  • Loading branch information
beerose committed Dec 1, 2021
2 parents 730b0aa + 3277e1e commit 4081227
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 8 deletions.
18 changes: 18 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -3481,6 +3481,24 @@
"doc",
"code"
]
},
{
"login": "davidchristie",
"name": "David Christie",
"avatar_url": "https://avatars.githubusercontent.com/u/12044333?v=4",
"profile": "https://github.com/davidchristie",
"contributions": [
"doc"
]
},
{
"login": "ajanth97",
"name": "Ajanth",
"avatar_url": "https://avatars.githubusercontent.com/u/50458502?v=4",
"profile": "https://github.com/ajanth97",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<img alt="" src="https://img.shields.io/badge/Join%20our%20community-6700EB.svg?style=for-the-badge&labelColor=000000&logoWidth=20&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAQ9SURBVHgB7d3dVdtAEIbhcSpICUoH0IEogQqSVBBSAU4FSSpIOoAORAfQgSghHXzZ1U/YcMD4R9rZmf2ec3y448LyiNf27iLiGIAmPLrweC9Un3DhrzG6EarLNP09nlwJ1SOZ/lQr5N80/S/p2QMVCBf5N17XCfm1Y/rBHqjAG9PPHvBsz+mf9WAP+HLA9M/YA14cOP2payH7jpj+VCtk1wnTP+vj7xCy6cTpn7EHLMLp059iD1iD8eveJbVCNsSLheX1YA/YgOWnf8YeKB3Wmf7Ud6Fy4f/FHmtpxbl3YlC4MJ/Cj0bWdwPnPbARg+L0S54XQHS32WwuxClzd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3QONkH+v9MBWqB7PeqDn9FcIT//kcitUn6kHOu/T/xfWzlQy3dEHhwAAAABJRU5ErkJggg==">
</a>
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-369-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-371-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<a aria-label="License" href="https://github.com/blitz-js/blitz/blob/canary/LICENSE">
<img alt="" src="https://img.shields.io/npm/l/blitz.svg?style=for-the-badge&labelColor=000000&color=blue">
Expand Down Expand Up @@ -729,6 +729,8 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
<td align="center"><a href="http://www.bitnative.com"><img src="https://avatars.githubusercontent.com/u/1688997?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cory House</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=coryhouse" title="Documentation">📖</a></td>
<td align="center"><a href="https://auspham.dev/"><img src="https://avatars.githubusercontent.com/u/16440123?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Austin (Thang Pham)</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=rockmanvnx6" title="Documentation">📖</a></td>
<td align="center"><a href="https://jammeryhq.com"><img src="https://avatars.githubusercontent.com/u/521777?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Marcus Reinhardt</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=noxify" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=noxify" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/davidchristie"><img src="https://avatars.githubusercontent.com/u/12044333?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Christie</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=davidchristie" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/ajanth97"><img src="https://avatars.githubusercontent.com/u/50458502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ajanth</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=ajanth97" title="Documentation">📖</a></td>
</tr>
</table>

Expand Down
12 changes: 11 additions & 1 deletion nextjs/packages/next/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
NextRouter,
extractRouterParams,
extractQueryFromAsPath,
resolveHref,
} from '../shared/lib/router/router'
import { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'
import {
Expand Down Expand Up @@ -382,6 +383,14 @@ function checkRedirectValues(
}
}

function normalizeRedirectValues(router: ServerRouter, redirect: Redirect) {
const dest = redirect.destination
if (dest && typeof dest === 'object') {
const resolvedDest = resolveHref(router, dest, true)
redirect.destination = resolvedDest[1] || resolvedDest[0]
}
}

export async function renderToHTML(
req: IncomingMessage,
res: ServerResponse,
Expand Down Expand Up @@ -748,12 +757,12 @@ export async function renderToHTML(

;(renderOpts as any).isNotFound = true
}

if (
'redirect' in data &&
data.redirect &&
typeof data.redirect === 'object'
) {
normalizeRedirectValues(router, data.redirect as Redirect)
checkRedirectValues(data.redirect as Redirect, req, 'getStaticProps')

if (isBuildTimeSSG) {
Expand Down Expand Up @@ -914,6 +923,7 @@ export async function renderToHTML(
}

if ('redirect' in data && typeof data.redirect === 'object') {
normalizeRedirectValues(router, data.redirect as Redirect)
checkRedirectValues(
data.redirect as Redirect,
req,
Expand Down
5 changes: 3 additions & 2 deletions nextjs/packages/next/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ declare module 'react' {
}
}

export type Destination = string | RouteUrlObject
export type Redirect =
| {
statusCode: 301 | 302 | 303 | 307 | 308
destination: string
destination: Destination
basePath?: false
}
| {
permanent: boolean
destination: string
destination: Destination
basePath?: false
}

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 @@ -25,7 +25,7 @@
"@prisma/client": "3.x",
"blitz": "canary",
"react-dom": "18.0.0-alpha-5ca4b0433-20211020",
"react": "18.0.0-alpha-5ca4b0433-20211020",
"react": "18.0.0-beta-149b420f6-20211119",
"zod": "3.x"
},
"devDependencies": {
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 @@
"@prisma/client": "3.x",
"blitz": "canary",
"react-dom": "18.0.0-alpha-5ca4b0433-20211020",
"react": "18.0.0-alpha-5ca4b0433-20211020",
"react": "18.0.0-beta-149b420f6-20211119",
"zod": "3.x"
},
"devDependencies": {
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": {
"blitz": "canary",
"react-dom": "18.0.0-alpha-5ca4b0433-20211020",
"react": "18.0.0-alpha-5ca4b0433-20211020"
"react": "18.0.0-beta-149b420f6-20211119"
},
"devDependencies": {
"eslint": "7.x",
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 @@ -22,7 +22,7 @@
"dependencies": {
"blitz": "canary",
"react-dom": "18.0.0-alpha-5ca4b0433-20211020",
"react": "18.0.0-alpha-5ca4b0433-20211020"
"react": "18.0.0-beta-149b420f6-20211119"
},
"devDependencies": {
"@types/react": "17.x",
Expand Down

0 comments on commit 4081227

Please sign in to comment.