Repository navigation
v2: public API for writing third-party serverValidateHelper framework plugins (e.g. React Router)
#2439
cr101
started this conversation in
v2 Ideas and Discussions
Replies: 1 comment
|
It can't yet, because the SSR adapters are doing too much work right now. We need to change the architecture of the SSR process first so that the plugin only does the parts that it actually needs to do. Until then, it will likely break. We are looking to make the final shape of it stable by v2 release, though. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
v2's
ServerValidateFrameworkPlugininterface is exported from@tanstack/form-core. But a plugin has nothing to call once it has decoded the request. The shipped Next.js plugin does its validation withvalidateServerValuesfrom@tanstack/form-core/internals, which isn't in the main entry point. So any third-party plugin also has to import from/internals.Could
validateServerValues(or an equivalent) be exported from the main@tanstack/form-coreentry and documented as stable for plugin authors?Context
v2 removed
@tanstack/react-form-remix. Its server plugins now cover only TanStack Start and Next.js, so React Router 7 users have no official way to do server validation. We don't think TanStack needs to own a React Router adapter. Making the plugin interface fully public would let the community write one, and the same goes for other frameworks.There are already React Router questions with no supported answer:
What a React Router plugin looks like on
2.0.0-alpha.2This is almost a copy of
packages/react-form-nextjs/src/index.tsonalpha. The only problem is the import from/internals:The route action would then be:
Ask
validateServerValues(or a plugin-facing wrapper) from@tanstack/form-coreand treat it as public API./internalsisn't the documented path.This fits the plugin-options rework in #2370, so it may be easiest to settle both together before v2 is stable.
All reactions