Skip to content

fix (docs): update createAI example, move AI to separate module#2956

Merged
nicoalbanese merged 6 commits into
mainfrom
update-docs
Sep 17, 2024
Merged

fix (docs): update createAI example, move AI to separate module#2956
nicoalbanese merged 6 commits into
mainfrom
update-docs

Conversation

@huozhi

@huozhi huozhi commented Sep 10, 2024

Copy link
Copy Markdown
Contributor

What & Why

Server action module (the module conatining "use server" on the top level) should only contain server actions but the AI component itself is not. So that's why I want to move it outside of actions.tsx and 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)

@nicoalbanese

Copy link
Copy Markdown
Contributor

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.

@huozhi

huozhi commented Sep 10, 2024

Copy link
Copy Markdown
Contributor Author

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 AI component itself is not. So that's why I want to move it outside of actions.tsx and leave it as a file or a module only containing actions with top-level directive convenience.

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. 🙏

@lgrammel

Copy link
Copy Markdown
Collaborator

Approved @nicoalbanese are you looking into the other cases?

@lgrammel lgrammel changed the title docs: update createAI example, move AI to separate module fix (docs): update createAI example, move AI to separate module Sep 11, 2024
@nicoalbanese

Copy link
Copy Markdown
Contributor

@lgrammel yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants