diff --git a/lerna.json b/lerna.json index 2ebca776d4be1..0e0ae23fd3159 100644 --- a/lerna.json +++ b/lerna.json @@ -17,5 +17,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "9.5.4-canary.2" + "version": "9.5.4-canary.3" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 540558f9aab61..19a6c5579bea3 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "keywords": [ "react", "next", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index fa169decc1f3a..785cfa7d43aaf 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "description": "ESLint plugin for NextJS.", "main": "lib/index.js", "license": "MIT", diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 375561d8dbb04..502876625b429 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 83a4af4f5f35e..c433afc9e4756 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "license": "MIT", "dependencies": { "chalk": "4.1.0", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 32d42280287d9..2603672834cd4 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-google-analytics/package.json b/packages/next-plugin-google-analytics/package.json index b503c0d5d0649..2e898f11e4941 100644 --- a/packages/next-plugin-google-analytics/package.json +++ b/packages/next-plugin-google-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-google-analytics", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-google-analytics" diff --git a/packages/next-plugin-sentry/package.json b/packages/next-plugin-sentry/package.json index 1ef3c462e6ef8..86c11e061bf60 100644 --- a/packages/next-plugin-sentry/package.json +++ b/packages/next-plugin-sentry/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-sentry", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-sentry" diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 5bc66be420aa6..fbe8129748141 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index c0aeaaa8adc9d..330d16472dddc 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next/next-server/lib/router/router.ts b/packages/next/next-server/lib/router/router.ts index b0e758dd69a02..2782c5cb317b9 100644 --- a/packages/next/next-server/lib/router/router.ts +++ b/packages/next/next-server/lib/router/router.ts @@ -597,7 +597,7 @@ export default class Router implements BaseRouter { if (process.env.__NEXT_HAS_REWRITES) { resolvedAs = resolveRewrites( - as, + parseRelativeUrl(as).pathname, pages, basePath, rewrites, diff --git a/packages/next/package.json b/packages/next/package.json index dc032b0f87624..2a67621a45f04 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -77,8 +77,8 @@ "@babel/preset-typescript": "7.10.4", "@babel/runtime": "7.11.2", "@babel/types": "7.11.5", - "@next/react-dev-overlay": "9.5.4-canary.2", - "@next/react-refresh-utils": "9.5.4-canary.2", + "@next/react-dev-overlay": "9.5.4-canary.3", + "@next/react-refresh-utils": "9.5.4-canary.3", "ast-types": "0.13.2", "babel-plugin-syntax-jsx": "6.18.0", "babel-plugin-transform-define": "2.0.0", @@ -123,7 +123,7 @@ "react-dom": "^16.6.0" }, "devDependencies": { - "@next/polyfill-nomodule": "9.5.4-canary.2", + "@next/polyfill-nomodule": "9.5.4-canary.3", "@taskr/clear": "1.1.0", "@taskr/esnext": "1.1.0", "@taskr/watch": "1.1.0", diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json index ad18a700789de..dbd24bb579042 100644 --- a/packages/react-dev-overlay/package.json +++ b/packages/react-dev-overlay/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-dev-overlay", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "description": "A development-only overlay for developing React applications.", "repository": { "url": "vercel/next.js", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 45afa18d3d07a..b342c34d8d1bd 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "9.5.4-canary.2", + "version": "9.5.4-canary.3", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/test/integration/custom-routes/pages/nav.js b/test/integration/custom-routes/pages/nav.js index 1da7ea1b70b99..c3ddcda6a7174 100644 --- a/test/integration/custom-routes/pages/nav.js +++ b/test/integration/custom-routes/pages/nav.js @@ -6,8 +6,27 @@ export default () => ( to hello +
to hello-again +
+ + to params (manual) + +
+ + to params + +
) diff --git a/test/integration/custom-routes/pages/with-params.js b/test/integration/custom-routes/pages/with-params.js index 84dcefda9ad6b..e33c2cf2cc237 100644 --- a/test/integration/custom-routes/pages/with-params.js +++ b/test/integration/custom-routes/pages/with-params.js @@ -2,7 +2,7 @@ import { useRouter } from 'next/router' const Page = () => { const { query } = useRouter() - return

{JSON.stringify(query)}

+ return

{JSON.stringify(query)}

} Page.getInitialProps = () => ({ hello: 'GIPGIP' }) diff --git a/test/integration/custom-routes/test/index.test.js b/test/integration/custom-routes/test/index.test.js index af3ca95058d2e..7c6737e087d27 100644 --- a/test/integration/custom-routes/test/index.test.js +++ b/test/integration/custom-routes/test/index.test.js @@ -314,6 +314,34 @@ const runTests = (isDev = false) => { expect(await getBrowserBodyText(browser)).toMatch(/Hello again/) }) + it('should work with rewrite when manually specifying href/as', async () => { + const browser = await webdriver(appPort, '/nav') + await browser + .elementByCss('#to-params-manual') + .click() + .waitForElementByCss('#query') + + const query = JSON.parse(await browser.elementByCss('#query').text()) + expect(query).toEqual({ + something: '1', + another: 'value', + }) + }) + + it('should work with rewrite when only specifying href', async () => { + const browser = await webdriver(appPort, '/nav') + await browser + .elementByCss('#to-params') + .click() + .waitForElementByCss('#query') + + const query = JSON.parse(await browser.elementByCss('#query').text()) + expect(query).toEqual({ + something: '1', + another: 'value', + }) + }) + it('should match a page after a rewrite', async () => { const html = await renderViaHTTP(appPort, '/to-hello') expect(html).toContain('Hello') diff --git a/test/integration/dynamic-routing/pages/another.js b/test/integration/dynamic-routing/pages/another.js index 31f103321ed81..8776e1d83fe5f 100644 --- a/test/integration/dynamic-routing/pages/another.js +++ b/test/integration/dynamic-routing/pages/another.js @@ -1 +1,3 @@ -export default () => 'hello from another!' +export default function Another() { + return 'hello from another!' +}