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

Add forms API #74

Merged
merged 34 commits into from
Mar 1, 2022
Merged

Add forms API #74

merged 34 commits into from
Mar 1, 2022

Conversation

nksaraf
Copy link
Member

@nksaraf nksaraf commented Feb 3, 2022

This introduces a new Form API for SolidStart. Will document it more, but I've demoed it before. It's essentially a createForm that takes an async function and returns a form you can render

Some size numbers:


// client mode SPA
dist/assets/_...stories_.e7092512.js   2.54 KiB / gzip: 0.89 KiB
dist/assets/_id_.1845bf77.js           2.24 KiB / gzip: 0.88 KiB
dist/assets/_id_.3b38f1ff.js           1.33 KiB / gzip: 0.59 KiB
dist/assets/index.fb42bad5.css         3.97 KiB / gzip: 1.28 KiB
dist/assets/index.4b06b870.js          29.20 KiB / gzip: 11.24 KiB

// without server side api, fetching on the client
dist/assets/_id_.77f41271.js            2.77 KiB / gzip: 1.02 KiB
dist/assets/entry-client.ef96127c.css   3.97 KiB / gzip: 1.28 KiB
dist/assets/_id_.d8aa775f.js            1.50 KiB / gzip: 0.67 KiB
dist/assets/_...stories_.b6819e6e.js    3.03 KiB / gzip: 1.03 KiB
dist/assets/entry-client.538286bb.js    29.74 KiB / gzip: 11.38 KiB

// with server side API, without redirect/forms
dist/assets/_id_.d8c75572.js            2.77 KiB / gzip: 1.02 KiB
dist/assets/_...stories_.8a56c3f8.js    3.03 KiB / gzip: 1.03 KiB
dist/assets/entry-client.ef96127c.css   3.97 KiB / gzip: 1.28 KiB
dist/assets/_id_.6f98f8bb.js            1.50 KiB / gzip: 0.67 KiB
dist/assets/entry-client.15481405.js    30.33 KiB / gzip: 11.65 KiB

// with server side api, redirects, forms, errors, returned/thrown responses
dist/assets/_...stories_.c8d32dcf.js    3.03 KiB / gzip: 1.02 KiB
dist/assets/_id_.7325f45b.js            2.77 KiB / gzip: 1.02 KiB
dist/assets/_id_.ec28dae0.js            1.50 KiB / gzip: 0.66 KiB
dist/assets/entry-client.ef96127c.css   3.97 KiB / gzip: 1.28 KiB
dist/assets/entry-client.87d12dfe.js    31.48 KiB / gzip: 12.00 KiB

@nksaraf nksaraf force-pushed the forms branch 2 times, most recently from 6484389 to be87b86 Compare February 4, 2022 10:33
feat: add routeData export from pages
expand support for declaring API routes
in entry-server

fix server utilities

add sessions support

add forms support

fix form and make them a bit better

fix solid bugs related to extra handlers

fix forms
```tsx
import server from "solid-start/server";

const serverFunction = server((name: string) => ({ messasge: `Hello ${name}` }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: messasge -> message

@ryansolid
Copy link
Member

Yes. This looks good.. Thank you so much for this one.

@ryansolid ryansolid merged commit f291480 into solidjs:main Mar 1, 2022
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.

4 participants