fix (docs): update createAI example, move AI to separate module#2956
Conversation
|
thanks for this @huozhi! I've repro'd and it seems possible to solve by moving the 'use server' directive to the specific function rather than at the top level of the file. |
|
Hey @nicoalbanese, provding more context here about the PR: I dicussed with @shuding about this, server action module (the module conatining "use server" on the top level) should only contain server actions but the On Next.js side we'll keep exploring the approaches to warn/error on that, and will address the regression of this case on 14.2. 🙏 |
|
Approved @nicoalbanese are you looking into the other cases? |
|
@lgrammel yes |
What & Why
Server action module (the module conatining "use server" on the top level) should only contain server actions but the
AIcomponent itself is not. So that's why I want to move it outside ofactions.tsxand leave it as a file or a module only containing actions with top-level directive convenience.Related issue: #2948
Related Next.js issue comment: vercel/next.js#69756 (comment)