Closed frenzzy closed 3 months ago
I think this is a regression from a recent change in the router. Thanks for reporting.
EDIT: No I was wrong.. a fix for this(https://github.com/solidjs/solid-start/pull/1552) actually broke the proper behavior. That issue needs to be fixed a different way.
EDIT 2: It's both. Solid Router update to 0.13.4 broke something as well. It appears that this pull request although it was merged earlier didn't come out until 0.13.4 and is the cause of the break: https://github.com/solidjs/solid-router/pull/405
Describe the bug
When user submits a form in NOJS mode, SolidStart sets a "flash=" cookie and redirects back to the same url:
During SSR it executes initFromFlash logic and extracts submission info from cookie: https://github.com/solidjs/solid-router/blob/10b7d8ce03d3aef11074199800bb78ea5fc1b426/src/routing.ts#L341
But unfortunately it does not become available in useSubmission hook: https://github.com/solidjs/solid-router/blob/10b7d8ce03d3aef11074199800bb78ea5fc1b426/src/data/action.ts#L27
Probably something is broken with reactivity or context on server-side...
Your Example Website or App
Please update demo link to fork using SolidStart 1.0
Steps to Reproduce the Bug or Issue
src/routes/demo.tsx
:const myAction = action(async (formData: FormData) => { 'use server' const value = String(formData.get('test')) await new Promise((resolve) => setTimeout(resolve, 1000)) return
It works! ${value}
}, 'myAction')export default function RouteExample() { const submission = useSubmission(myAction) console.log(getRequestEvent()?.router?.submission?.url) // _server?id=%2FUsers%2Fsite%2Fy%2Fsrc%2Froutes%2Fx.tsx%3Fpick%3Ddefault%26pick%3D%24css&name=%24%24function0 console.log(getRequestEvent()?.router?.submission?.result) // 'It works! 123' console.log(submission.result) // undefined console.log(submission.url) // undefined return (
) }