-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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: disallow exporting actions
from a +layout.server
file
#10046
Conversation
🦋 Changeset detectedLatest commit: 58cd9c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
+layout.server.js
in the form actions docs+layout.server.js
in the form actions docs
+layout.server.js
in the form actions docs+layout.server.js
in the form actions section
I don´t think you can do that. Vscode gives me this error:
|
Huh. That's weird. It's suppose to be valid based on the code here: kit/packages/kit/src/utils/exports.js Line 72 in f8cf1fe
and it's tested here kit/packages/kit/src/utils/exports.spec.js Lines 114 to 118 in f8cf1fe
|
Not sure if we need to update language tools to allow |
I wonder how actions in layout files would work, specifically how you would call them from the client (what to put in the form action attribute?). Page and layout actions could collide, how would the server choose between |
I... would expect you shouldn't export |
+layout.server.js
in the form actions sectionactions
from a +layout.server
file
Found out we can exportactions
in a layout file but it isn't mentioned anywhere in the docs.I don't think we're suppose to export actions from a layout file. #10046 (comment)
This PR changes the list of valid exports to disallow the
actions
export from a+layout.server
file (matching the language tools behaviour).Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.