forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct query behavior for falsey values to pre 9.5.1 behavior (verce…
…l#16608) Fixes vercel#16147
- Loading branch information
Showing
6 changed files
with
85 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
test/integration/client-navigation/pages/nav/query-params.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useRouter } from 'next/router' | ||
|
||
export default function Page() { | ||
const router = useRouter() | ||
return ( | ||
<> | ||
<button | ||
id="click-me" | ||
onClick={() => | ||
router.push({ | ||
pathname: '/query', | ||
query: { | ||
param1: '', | ||
param2: undefined, | ||
param3: null, | ||
param4: 0, | ||
param5: false, | ||
param6: [], | ||
param7: {}, | ||
param8: NaN, | ||
param9: new Date(1234), | ||
param10: /hello/, | ||
param11: [ | ||
'', | ||
undefined, | ||
null, | ||
0, | ||
false, | ||
[], | ||
{}, | ||
NaN, | ||
new Date(1234), | ||
/hello/, | ||
], | ||
}, | ||
}) | ||
} | ||
> | ||
Click me | ||
</button> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useRouter } from 'next/router' | ||
|
||
export default function Page() { | ||
const router = useRouter() | ||
return <pre id="query-value">{JSON.stringify(router.query, null, 2)}</pre> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters