diff --git a/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/ServerDelayForm.css b/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/ServerDelayForm.css new file mode 100644 index 000000000000..b91771ebd974 --- /dev/null +++ b/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/ServerDelayForm.css @@ -0,0 +1,11 @@ +.server-delay-form { + padding: 1rem; + + label div { + margin-bottom: 4px; + } + + input { + margin-right: 4px; + } +} diff --git a/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/ServerDelayForm.tsx b/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/ServerDelayForm.tsx new file mode 100644 index 000000000000..cd6d80416b14 --- /dev/null +++ b/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/ServerDelayForm.tsx @@ -0,0 +1,27 @@ +import fs from 'node:fs' + +import { formAction } from './actions' + +import './ServerDelayForm.css' + +const ServerDelayForm = () => { + let delay = 0 + + if (fs.existsSync('settings.json')) { + delay = JSON.parse(fs.readFileSync('settings.json', 'utf8')).delay || 0 + } + + return ( +
+
+ + +
+
+ ) +} + +export default ServerDelayForm diff --git a/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/actions.ts b/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/actions.ts new file mode 100644 index 000000000000..6fc9ebb65b2a --- /dev/null +++ b/__fixtures__/rsc-caching/web/src/components/ServerDelayForm/actions.ts @@ -0,0 +1,12 @@ +'use server' + +import fs from 'node:fs' + +export async function formAction(formData: FormData) { + console.log(formData.get('delay')) + console.log('cwd', process.cwd()) + await fs.promises.writeFile( + 'settings.json', + `{ "delay": ${formData.get('delay')} }\n` + ) +}