-
Notifications
You must be signed in to change notification settings - Fork 407
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
When importing the same server-only utility into a file with queries (query), and one of those queries is not marked "use server", it breaks an unrelated form action.
I've created the following reproduction repository if something is unclear: https://github.com/KipzonderKop101/solidstart-action-bug
The highlights are as follows. When creating two queries in the same file, both importing the same server-only utility function. For example: createSomeClient(), createSomeClient() makes use of Vinxi's HTTP APIs.
The issue starts when secondaryUnreleatedQuery is not marked as "use server", even when not imported or used anywere.
The primary query remains functional, but if any actions are used inside the component, these fail silently by routing the user to a non-existing webpage (e.g. https://action/performRandomAction).
export const secondaryUnreleatedQuery = query(async () => {
const client = await createSomeClient();
console.log("Fetching random data with client:", client);
}, "secondaryUnrelatedData");
// The query used on the index page
export const fetchRandomDataQuery = query(async () => {
"use server";
const client = await createSomeClient();
console.log("Fetching random data with client:", client);
}, "randomData");Expected behavior 🤔
Although it's a user error to not mark their intended server query with "use server", this should not cause just the action to fail silently.
Steps to reproduce 🕹
I've created a reproduction repository here: https://github.com/KipzonderKop101/solidstart-action-bug
The highlights are:
- Create two queries in the same file, both using the same server-only utility, but mark only the one you are using with
"use server". - Create a component using the primary
querywithcreateAsync - Create a form inside this component and handle it with
action.
Context 🔦
I was trying to accomplish a client-side form execution, where I kept being routed to the page mentioned earlier. This secondary query fails silently, and was not imported / used in my code. This made debugging though.
Your environment 🌎
Sytem:
- OS: EndeavourOS Linux x86_64
- CPU: 12th Gen Intel i5-1235U (12) @
Binaries:
- /usr/bin/npm
Packages:
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.15.0",
"@solidjs/start": "^1.1.0",
"solid-js": "^1.9.5",
"vinxi": "^0.5.7"