Skip to content

Add TanStack Form example#2607

Closed
nrainhart wants to merge 15 commits intomainfrom
feat/tanstack-form-example
Closed

Add TanStack Form example#2607
nrainhart wants to merge 15 commits intomainfrom
feat/tanstack-form-example

Conversation

@nrainhart
Copy link
Contributor

@nrainhart nrainhart commented Jul 4, 2025

What this Does

Add a TanStack Form example to our examples library. This example is based off our existing form example, but shows how to integrate with form libraries (which are usually not very friendly with non-JSON objects, such as CoValues) and leverage TanStack Form's support for schema validation libraries to validate the form using Jazz's Zod-based schemas.

Screen.Recording.2025-07-04.at.5.13.53.PM.mov

Why Are We Doing This?

This started off as me researching our form-building experience with Jazz, but after discussing it with @gdorsi we thought this could make sense as an example.

Open Questions

I initially wanted to make this an Svelte project (in fact, I've got an early prototype here) but ended up spending more time playing with Zod validations (instead of working through some styling quirks product of the Svelte migration) and thus kept the example in React. If you think it'd be more valuable to make this an Svelte example, let me know and I can spend a bit more time working on it!

Testing Instructions

Added an e2e example to confirm the basic create & edit functionality works as expected.

Related Links

@nrainhart nrainhart requested a review from gdorsi July 4, 2025 20:15
@vercel
Copy link

vercel bot commented Jul 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 0:59am
design-system ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 0:59am
file-upload-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 0:59am
gcmp-homepage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 0:59am
jazz-todo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 0:59am
music-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 0:59am
passphrase-auth-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 0:59am
18 Skipped Deployments
Name Status Preview Comments Updated (UTC)
jazz-chat-2 ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
jazz-filestream ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
jazz-homepage ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
jazz-image-upload ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
jazz-organization ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
jazz-paper-scissors ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
jazz-richtext-prosekit ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
jazz-richtext-tiptap ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
jazz-version-history ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 0:59am
form-demo ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am
image-upload-demo ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am
jazz-chat ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am
jazz-chat-1 ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am
jazz-inspector ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am
jazz-multi-cursors ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am
jazz-richtext ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am
passkey-demo ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am
reactions-demo ⬜️ Skipped (Inspect) Jul 7, 2025 0:59am


getCoSchema: () => typeof CoMap;

getZodSchema: () => z.ZodObject<Shape, Config>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should add this API as part of #2404

After the splitting we are going to need this API more, and the implementation will also probably differ after those changes.

"examples/inspector",
"examples/music-player",
"examples/organization",
"examples/tanstack-form",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Added the test to the CI, but it looks like this doesn't pass

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@vercel vercel bot temporarily deployed to Preview – reactions-demo July 7, 2025 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – file-upload-demo July 7, 2025 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – passphrase-auth-demo July 7, 2025 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – jazz-multi-cursors July 7, 2025 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – jazz-richtext July 7, 2025 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – image-upload-demo July 7, 2025 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – jazz-chat-1 July 7, 2025 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – form-demo July 7, 2025 12:51 Inactive
@nrainhart
Copy link
Contributor Author

@gdorsi without CoValueSchema.getZodSchema this example is quite verbose and not something I'd like to showcase. I'd prefer to wait until we add that API (including the CoSchema -> Zod conversion for all the defined fields) and then adjust this example and merge it. If you think we should merge this sooner, lmk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants