Title: [Feature]: Progressive-enhancement form actions + optimistic updates · Issue #140 · bQuery/bQuery · GitHub
Open Graph Title: [Feature]: Progressive-enhancement form actions + optimistic updates · Issue #140 · bQuery/bQuery
X Title: [Feature]: Progressive-enhancement form actions + optimistic updates · Issue #140 · bQuery/bQuery
Description: Pre-flight checklist I searched existing issues and did not find a duplicate request. I explained the problem or use case, not just the desired API. Problem or use case bQuery forms submit via JS (onSubmit) only — there is no progressive...
Open Graph Description: Pre-flight checklist I searched existing issues and did not find a duplicate request. I explained the problem or use case, not just the desired API. Problem or use case bQuery forms submit via JS (...
X Description: Pre-flight checklist I searched existing issues and did not find a duplicate request. I explained the problem or use case, not just the desired API. Problem or use case bQuery forms submit via JS (...
Opengraph URL: https://github.com/bQuery/bQuery/issues/140
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Feature]: Progressive-enhancement form actions + optimistic updates","articleBody":"**Pre-flight checklist**\n- [x] I searched existing issues and did not find a duplicate request.\n- [x] I explained the problem or use case, not just the desired API.\n\n**Problem or use case**\nbQuery forms submit via JS (`onSubmit`) only — there is no progressive-enhancement model where a form posts to a server action and works even before/without client JS, and no optimistic-update primitive for instant feedback. React 19 added function `action`/`formAction` props on `\u003cform\u003e`/`\u003cinput\u003e`/`\u003cbutton\u003e` with `useActionState`, `useFormStatus`, and `useOptimistic`; SvelteKit ships server `form actions`. bQuery, despite having both a `forms` module and a `server` module, does not connect them this way, which is a concrete gap for resilient apps.\n\n**Proposed solution**\nAdd a form-action model that binds a form to a server action (via the `server` module / file-based route actions in #149), submits as a normal POST when JS is unavailable, and progressively enhances to a fetch-based submit with pending state when JS is present. Add an optimistic-update primitive so the UI can reflect the expected result immediately and reconcile on response. Must compose with the existing validation pipeline and with sessions/CSRF from #132.\n\n**Possible API or UX shape**\n```ts\nimport { formAction, useFormStatus, optimistic } from \"@bquery/bquery/forms\";\n\n// binds to a server action; falls back to native POST without JS\nconst submit = formAction(\"/todos\", { method: \"POST\" });\n\nconst { pending } = useFormStatus(submit);\nconst list = optimistic(todos, (cur, draft) =\u003e [...cur, draft]); // instant feedback\n```\n\n**Alternatives considered**\nKeeping JS-only submit and documenting manual `fetch` patterns — leaves bQuery without the resilience and ergonomics React 19/SvelteKit now treat as standard. Building optimistic updates only in `store` — possible, but form submission is where users expect it, so the primitive should be reachable from `forms`.\n\n**Relevant area**\n`forms`\n\n**Additional context**\nDepends on `server` session/CSRF (#132) and pairs with file-based route actions (#149). This is one of the headline React-19-parity features.\n","author":{"url":"https://github.com/JosunLP","@type":"Person","name":"JosunLP"},"datePublished":"2026-06-26T21:25:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/140/bQuery/issues/140"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f2296b22-269e-b6a0-bec0-14493e8a1ad9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7DA:1E53DB:AF78A4:B37DC2:6A4DB75C |
| html-safe-nonce | 7d10add55856041261f20d5e171f3bf7e54d1e52d1a7620244eb0435d4d3ad78 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0RBOjFFNTNEQjpBRjc4QTQ6QjM3REMyOjZBNERCNzVDIiwidmlzaXRvcl9pZCI6IjYwNDk1NTYzMzAwNzgzNDk3MiIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 2a19abef01b2ef9f587cc8f17a8ae035953c8bab2d3f96f24a3b5944f101f981 |
| hovercard-subject-tag | issue:4755238673 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bQuery/bQuery/140/issue_layout |
| twitter:image | https://opengraph.githubassets.com/afe81462f3135ed1a9cd54bbf6106da4126e2c6aa16eb4d84a410a5501974511/bQuery/bQuery/issues/140 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/afe81462f3135ed1a9cd54bbf6106da4126e2c6aa16eb4d84a410a5501974511/bQuery/bQuery/issues/140 |
| og:image:alt | Pre-flight checklist I searched existing issues and did not find a duplicate request. I explained the problem or use case, not just the desired API. Problem or use case bQuery forms submit via JS (... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JosunLP |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/bQuery/bQuery git https://github.com/bQuery/bQuery.git |
| octolytics-dimension-user_id | 256381806 |
| octolytics-dimension-user_login | bQuery |
| octolytics-dimension-repository_id | 1139284244 |
| octolytics-dimension-repository_nwo | bQuery/bQuery |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1139284244 |
| octolytics-dimension-repository_network_root_nwo | bQuery/bQuery |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32f7b614aca06e6bbd89842b1370df1328264f68 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width