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

Change the Server Actions feature flag to be validated at compile time #52147

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

shuding
Copy link
Member

@shuding shuding commented Jul 3, 2023

Currently we are validating the experimental.serverActions flag when creating the actual entries for Server Actions, this causes two problems. One is that syntax errors caught at compilation time are still shown, even if you don't have this flag enabled. Another problem is we still traverse the client graph to collect these action modules even if the flag isn't enabled.

This PR moves that check to be happening at compilation time, which addresses the two above but also brings the extra benefit of showing the exact span and module trace that errors:

CleanShot 2023-07-03 at 20 26 34@2x

@ijjk
Copy link
Member

ijjk commented Jul 3, 2023

Tests Passed

@shuding shuding marked this pull request as ready for review July 3, 2023 19:08
@kodiakhq kodiakhq bot merged commit 3a87f00 into canary Jul 3, 2023
@kodiakhq kodiakhq bot deleted the shu/da87 branch July 3, 2023 20:29
shuding added a commit that referenced this pull request Jul 8, 2023
#52147)

Currently we are validating the `experimental.serverActions` flag when creating the actual entries for Server Actions, this causes two problems. One is that syntax errors caught at compilation time are still shown, even if you don't have this flag enabled. Another problem is we still traverse the client graph to collect these action modules even if the flag isn't enabled.

This PR moves that check to be happening at compilation time, which addresses the two above but also brings the extra benefit of showing the exact span and module trace that errors:

<img width="974" alt="CleanShot 2023-07-03 at 20 26 34@2x" src="https://github.com/vercel/next.js/assets/3676859/1676b1f6-e205-4963-bce4-5b515a698e9c">
@github-actions github-actions bot added the locked label Aug 3, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants