Skip to content

Commit

Permalink
RSC: RSF aka Server Actions (#9155)
Browse files Browse the repository at this point in the history
Turns out React Server Functions aka Server Actions were almost working
already. Just had a bug in how we marked server action files with "use
server".


https://github.com/redwoodjs/redwood/assets/30793/71df96ed-a67f-4ef2-9b93-b18403174892
  • Loading branch information
Tobbe committed Sep 11, 2023
1 parent d3475cd commit c46bb67
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/vite/src/waku-lib/build-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ export async function serverBuild(
code += '"use client";'
}

const serverKeys = Object.keys(serverEntryFiles)
if (chunk.moduleIds.some((id) => serverKeys.includes(id))) {
const serverValues = Object.values(serverEntryFiles)
console.log('serverValues', serverValues)
if (chunk.moduleIds.some((id) => serverValues.includes(id))) {
console.log('adding "use server" to', chunk.fileName)
code += '"use server";'
}
return code
Expand Down

0 comments on commit c46bb67

Please sign in to comment.