Unverified Commit b993afbf authored by yudai yamamoto's avatar yudai yamamoto Committed by GitHub

Fix action failures due to state tree encoding (#53655)

fixes #53654

### Related PRs
- #51017
parent 78b04980
...@@ -52,7 +52,7 @@ async function fetchServerAction( ...@@ -52,7 +52,7 @@ async function fetchServerAction(
headers: { headers: {
Accept: RSC_CONTENT_TYPE_HEADER, Accept: RSC_CONTENT_TYPE_HEADER,
'Next-Action': actionId, 'Next-Action': actionId,
[NEXT_ROUTER_STATE_TREE]: JSON.stringify(state.tree), [NEXT_ROUTER_STATE_TREE]: encodeURIComponent(JSON.stringify(state.tree)),
...(process.env.__NEXT_ACTIONS_DEPLOYMENT_ID && ...(process.env.__NEXT_ACTIONS_DEPLOYMENT_ID &&
process.env.NEXT_DEPLOYMENT_ID process.env.NEXT_DEPLOYMENT_ID
? { ? {
......
...@@ -393,6 +393,16 @@ createNextDescribe( ...@@ -393,6 +393,16 @@ createNextDescribe(
return newTestCookie !== currentTestCookie ? 'success' : 'failure' return newTestCookie !== currentTestCookie ? 'success' : 'failure'
}, 'success') }, 'success')
}) })
it('should handle unicode search params', async () => {
const browser = await next.browser('/server?name=名')
const cnt = await browser.elementByCss('h1').text()
expect(cnt).toBe('0')
await browser.elementByCss('#inc').click()
await check(() => browser.elementByCss('h1').text(), '1')
})
}) })
describe('fetch actions', () => { describe('fetch actions', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment