Comments (3)
This has been reported here as well:
Since the _rsc request is discarded, in light of a redirect, the tests setup in test/e2e/app-dir/navigation/navigation.test.ts pass, but the issue is there too.
For example, say, you have this route handler:
// test/e2e/app-dir/navigation/app/redirect/result/api/route.js
let t = 0
const getTime = () => t++
export const GET = (req) => {
const rsc = req.nextUrl.searchParams.get('_rsc')
return new Response(
`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1 id="result-page">Result Page</h1>
<div id="counter">${getTime()}</div>
<div id="rsc">${rsc || 'no-rsc'}</div>
</body>
</html>
`,
{ status: 200, statusText: 'OK', headers: { 'Content-Type': 'text/html' } }
)
}
Then you can write a test:
// test/e2e/app-dir/navigation/navigation.test.ts around line 500-ish
it('should only trigger the redirect once for Route Handlers', async () => {
const path = '/redirect/redirect-with-loading/to-api'
const browser = await next.browser(path)
const counter = await browser.waitForElementByCss('#counter').text()
expect(counter).toBe('0')
})
And that'll error out because counter will be actually 1.
I haven't had time to deep dive into why the _rsc request is made though
from next.js.
Fixed #66620
from next.js.
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
from next.js.
Related Issues (20)
- Scroll Position Issue When Changing Pages HOT 3
- Compilation is slow HOT 1
- Server actions regression in 14.2.8: “Failed to find Server Action” HOT 13
- Not deployable out the gate
- Intercepting Routes - refresh when modal is open cannot go back to modal again unless another refresh HOT 1
- app router does not resolve routes according to `generateStaticParams` constraints HOT 9
- Invalid Metadata properties caused by Route Group and Parallel Route at the same Level HOT 1
- Setting a cookie in middleware & a server action results in duplicate Set-Cookie headers HOT 8
- NoFallbackError on 404 routes with pages router and middleware. HOT 1
- NoFallbackError on 404 routes with pages router and middleware. HOT 1
- Docs: The docs say Next.JS 14 supports experimental PPR but anecdotal evidence says otherwise HOT 2
- Debugging issue with Error Code SIGLL HOT 1
- Version info in error page shows different font sizes
- Debugging issue with Error Code SIGLL
- @next/swc-android-arm64 on build error HOT 1
- Server action in 18.2.6 vs 18.2.8 is not longer able to import server action in client component HOT 6
- With the `experimental-https` and `-H` options, the next dev will show a different URL
- Docs: Improve scripts
- Docs: NextImage document for png file
- Failed to find action after updating to `[email protected]` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next.js.