Skip to content

Commit 5662d41

Browse files
authored
sync aws #849 (#633)
1 parent 4eb185f commit 5662d41

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import { configurePlaywright } from "../../../common/config-e2e";
22

3-
// We need to disable parallel execution for the experimental app, otherwise it breaks the SSR test
4-
export default configurePlaywright("experimental", { parallel: false });
3+
export default configurePlaywright("experimental");

examples/e2e/experimental/e2e/use-cache.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { expect, test } from "@playwright/test";
33
test.describe("Composable Cache", () => {
44
test("cached component should work in ssr", async ({ page }) => {
55
await page.goto("/use-cache/ssr");
6-
let fullyCachedElt = page.getByTestId("fullyCached");
6+
let fullyCachedElt = page.getByTestId("fully-cached");
77
let isrElt = page.getByTestId("isr");
88
await expect(fullyCachedElt).toBeVisible();
99
await expect(isrElt).toBeVisible();
@@ -12,9 +12,10 @@ test.describe("Composable Cache", () => {
1212
const initialIsrText = await isrElt.textContent();
1313

1414
let isrText = initialIsrText;
15+
1516
do {
1617
await page.reload();
17-
fullyCachedElt = page.getByTestId("fullyCached");
18+
fullyCachedElt = page.getByTestId("fully-cached");
1819
isrElt = page.getByTestId("isr");
1920
await expect(fullyCachedElt).toBeVisible();
2021
await expect(isrElt).toBeVisible();
@@ -27,7 +28,7 @@ test.describe("Composable Cache", () => {
2728

2829
test("revalidateTag should work for fullyCached component", async ({ page, request }) => {
2930
await page.goto("/use-cache/ssr");
30-
const fullyCachedElt = page.getByTestId("fullyCached");
31+
const fullyCachedElt = page.getByTestId("fully-cached-with-tag");
3132
await expect(fullyCachedElt).toBeVisible();
3233

3334
const initialFullyCachedText = await fullyCachedElt.textContent();
@@ -45,7 +46,7 @@ test.describe("Composable Cache", () => {
4546
test("cached component should work in isr", async ({ page }) => {
4647
await page.goto("/use-cache/isr");
4748

48-
let fullyCachedElt = page.getByTestId("fullyCached");
49+
let fullyCachedElt = page.getByTestId("fully-cached");
4950
let isrElt = page.getByTestId("isr");
5051

5152
await expect(fullyCachedElt).toBeVisible();
@@ -61,7 +62,7 @@ test.describe("Composable Cache", () => {
6162
while (isrText === initialIsrText) {
6263
await page.reload();
6364
isrElt = page.getByTestId("isr");
64-
fullyCachedElt = page.getByTestId("fullyCached");
65+
fullyCachedElt = page.getByTestId("fully-cached");
6566
await expect(isrElt).toBeVisible();
6667
isrText = await isrElt.textContent();
6768
await expect(fullyCachedElt).toBeVisible();
@@ -72,7 +73,7 @@ test.describe("Composable Cache", () => {
7273

7374
do {
7475
await page.reload();
75-
fullyCachedElt = page.getByTestId("fullyCached");
76+
fullyCachedElt = page.getByTestId("fully-cached");
7677
isrElt = page.getByTestId("isr");
7778
await expect(fullyCachedElt).toBeVisible();
7879
await expect(isrElt).toBeVisible();

examples/e2e/experimental/src/app/use-cache/ssr/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FullyCachedComponent, ISRComponent } from "@/components/cached";
1+
import { FullyCachedComponent, FullyCachedComponentWithTag, ISRComponent } from "@/components/cached";
22
import { headers } from "next/headers";
33
import { Suspense } from "react";
44

@@ -12,6 +12,9 @@ export default async function Page() {
1212
<Suspense fallback={<p>Loading...</p>}>
1313
<FullyCachedComponent />
1414
</Suspense>
15+
<Suspense fallback={<p>Loading...</p>}>
16+
<FullyCachedComponentWithTag />
17+
</Suspense>
1518
<Suspense fallback={<p>Loading...</p>}>
1619
<ISRComponent />
1720
</Suspense>

examples/e2e/experimental/src/components/cached.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import { unstable_cacheLife, unstable_cacheTag } from "next/cache";
22

33
export async function FullyCachedComponent() {
4+
"use cache";
5+
return (
6+
<div>
7+
<p data-testid="fully-cached">{Date.now()}</p>
8+
</div>
9+
);
10+
}
11+
12+
export async function FullyCachedComponentWithTag() {
413
"use cache";
514
unstable_cacheTag("fullyTagged");
615
return (
716
<div>
8-
<p data-testid="fullyCached">{Date.now()}</p>
17+
<p data-testid="fully-cached-with-tag">{Date.now()}</p>
918
</div>
1019
);
1120
}

0 commit comments

Comments
 (0)