Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Sep 17, 2024

Conversation

huozhi
Copy link
Member

@huozhi huozhi commented Sep 10, 2024

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
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
Copy link
Member Author

huozhi commented Sep 10, 2024

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
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
Contributor

@lgrammel yes

@nicoalbanese nicoalbanese merged commit b883583 into main Sep 17, 2024
8 checks passed
@nicoalbanese nicoalbanese deleted the update-docs branch September 17, 2024 10:23
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