Skip to content

Commit 6178f64

Browse files
committed
review fix and package update
1 parent 46b9739 commit 6178f64

File tree

5 files changed

+90
-91
lines changed

5 files changed

+90
-91
lines changed

examples/experimental/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"clean": "rm -rf .turbo node_modules .next .open-next"
1212
},
1313
"dependencies": {
14-
"next": "15.3.1-canary.13",
14+
"next": "15.4.0-canary.14",
1515
"react": "catalog:",
1616
"react-dom": "catalog:"
1717
},

examples/experimental/src/components/dynamic.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
import { setTimeout } from "node:timers/promises";
12
import { headers } from "next/headers";
23

34
export async function DynamicComponent() {
45
const _headers = await headers();
56
// Simulate a delay to mimic server-side calls
6-
const date = await new Promise((resolve) =>
7-
setTimeout(() => {
8-
resolve(new Date().toString());
9-
}, 1000),
10-
);
7+
await setTimeout(1000, new Date().toString());
118
return (
129
<div>
1310
<h1>Dynamic Component</h1>
Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
import { expect, test } from "@playwright/test";
22

3-
test("Node middleware should add headers", async ({ request }) => {
4-
const resp = await request.get("/");
5-
expect(resp.status()).toEqual(200);
6-
const headers = resp.headers();
7-
expect(headers["x-middleware-test"]).toEqual("1");
8-
expect(headers["x-random-node"]).toBeDefined();
9-
});
3+
test.describe("Node Middleware", () => {
4+
test("Node middleware should add headers", async ({ request }) => {
5+
const resp = await request.get("/");
6+
expect(resp.status()).toEqual(200);
7+
const headers = resp.headers();
8+
expect(headers["x-middleware-test"]).toEqual("1");
9+
expect(headers["x-random-node"]).toBeDefined();
10+
});
1011

11-
test("Node middleware should return json", async ({ request }) => {
12-
const resp = await request.get("/api/hello");
13-
expect(resp.status()).toEqual(200);
14-
const json = await resp.json();
15-
expect(json).toEqual({ name: "World" });
16-
});
12+
test("Node middleware should return json", async ({ request }) => {
13+
const resp = await request.get("/api/hello");
14+
expect(resp.status()).toEqual(200);
15+
const json = await resp.json();
16+
expect(json).toEqual({ name: "World" });
17+
});
1718

18-
test("Node middleware should redirect", async ({ page }) => {
19-
await page.goto("/redirect");
20-
await page.waitForURL("/");
21-
const el = page.getByText("Incremental PPR");
22-
await expect(el).toBeVisible();
23-
});
19+
test("Node middleware should redirect", async ({ page }) => {
20+
await page.goto("/redirect");
21+
await page.waitForURL("/");
22+
const el = page.getByText("Incremental PPR");
23+
await expect(el).toBeVisible();
24+
});
2425

25-
test("Node middleware should rewrite", async ({ page }) => {
26-
await page.goto("/rewrite");
27-
const el = page.getByText("Incremental PPR");
28-
await expect(el).toBeVisible();
26+
test("Node middleware should rewrite", async ({ page }) => {
27+
await page.goto("/rewrite");
28+
const el = page.getByText("Incremental PPR");
29+
await expect(el).toBeVisible();
30+
});
2931
});
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
import { expect, test } from "@playwright/test";
22

3-
test("PPR should show loading first", async ({ page }) => {
4-
await page.goto("/");
5-
await page.getByRole("link", { name: "Incremental PPR" }).click();
6-
await page.waitForURL("/ppr");
7-
const loading = page.getByText("Loading...");
8-
await expect(loading).toBeVisible();
9-
const el = page.getByText("Dynamic Component");
10-
await expect(el).toBeVisible();
11-
});
3+
test.describe("PPR", () => {
4+
test("PPR should show loading first", async ({ page }) => {
5+
await page.goto("/");
6+
await page.getByRole("link", { name: "Incremental PPR" }).click();
7+
await page.waitForURL("/ppr");
8+
const loading = page.getByText("Loading...");
9+
await expect(loading).toBeVisible();
10+
const el = page.getByText("Dynamic Component");
11+
await expect(el).toBeVisible();
12+
});
1213

13-
test("PPR rsc prefetch request should be cached", async ({ request }) => {
14-
const resp = await request.get("/ppr", {
15-
headers: { rsc: "1", "next-router-prefetch": "1" },
14+
test("PPR rsc prefetch request should be cached", async ({ request }) => {
15+
const resp = await request.get("/ppr", {
16+
headers: { rsc: "1", "next-router-prefetch": "1" },
17+
});
18+
expect(resp.status()).toEqual(200);
19+
const headers = resp.headers();
20+
expect(headers["x-nextjs-postponed"]).toEqual("1");
21+
expect(headers["x-nextjs-cache"]).toEqual("HIT");
22+
expect(headers["cache-control"]).toEqual("s-maxage=31536000");
1623
});
17-
expect(resp.status()).toEqual(200);
18-
const headers = resp.headers();
19-
expect(headers["x-nextjs-postponed"]).toEqual("1");
20-
expect(headers["x-nextjs-cache"]).toEqual("HIT");
21-
expect(headers["cache-control"]).toEqual("s-maxage=31536000");
2224
});

pnpm-lock.yaml

Lines changed: 43 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)