@@ -77,41 +77,34 @@ export async function oldPattern() {
7777** Test Source** : ` test/e2e/app-dir/use-cache/app/(partially-static)/form/page.tsx `
7878
7979``` typescript
80- ' use cache'
81- import { cacheLife , cacheTag } from ' next/cache'
80+ import { updateTag , cacheTag } from ' next/cache'
8281
83- async function getTime() {
84- ' use cache'
85- cacheTag (' time' )
86- cacheLife (' hours' )
87- return Date .now ()
82+ async function refresh() {
83+ ' use server'
84+ updateTag (' home' )
8885}
8986
9087export default async function Page() {
91- const time = await getTime ()
88+ ' use cache'
89+ cacheTag (' home' )
9290
9391 return (
94- <>
95- < p id = " t" > {time }< / p >
96- < form action = {async () => {
97- ' use server'
98- await revalidateTag(' time' )
99- refresh() // ← Refresh current page
100- }}>
101- < button id = " refresh" type = " submit" > Refresh < / button >
102- < / form >
103- < / >
92+ < form action = {refresh }>
93+ < button id = " refresh" > Refresh < / button >
94+ < p id = " t" > {new Date().toISOString()}< / p >
95+ < / form >
10496 )
10597}
10698
107- // TEST BEHAVIOR (lines 612-633):
108- // 1. Initial load: time1 = 1234567890
109- // 2. Reload page: time2 = 1234567890 (same, cached)
110- // 3. Click refresh button:
111- // - revalidateTag('time') called
112- // - refresh() called
113- // - Page updates in place
114- // 4. Check time: time3 ≠ time2 (updated!)
99+ // ACTUAL TEST BEHAVIOR:
100+ // 1. Initial load: timestamp = "2024-01-01T12:00:00.000Z"
101+ // 2. Click refresh button:
102+ // - updateTag('home') called (invalidates cache)
103+ // - Page re-renders with new timestamp
104+ // 3. New timestamp displayed (cache was invalidated)
105+ //
106+ // NOTE: This uses updateTag(), not revalidateTag()
107+ // refresh() here is the server action name, not the next/cache function
115108```
116109
117110---
0 commit comments