-
-
Notifications
You must be signed in to change notification settings - Fork 71
[Feature]: ValidatedForm wrapper #437
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
Comments
Hi! I'd love to hear more about what specific APIs are giving you trouble. If there's something we can add to make it easier, I'm happy to do it. In case any of this helps, here are a couple clarifications that might not be clear from the docs in their current state: A lot of old forms might still workEven though the new documentation highlights the new APIs as the new recommendations, a lot of simple forms can translate over directly without changes. For example, if your form looks like this: <ValidatedForm
validator={myValidator}
method="post"
id="myFormId"
>
<MyInputField name="name" />
</ValidatedForm> It should work as-is just by updating your imports in the form and Then new and old version can existing in the same codebaseSince the new version has a new package name, it an coexist with the old version. Recipes for removed hooksFor the hooks that were removed, the migration guide has some recipes for how you can recreate them in userland: https://www.rvf-js.io/migration#deprecated-hooks You can use
|
Thanks. Yeah, but the "old version" had a lot of issues, in particular with validation refreshes and controlfield initialization. We created a form wrapper library around validated form primitives (TextInput, Toggle, etc). So, migration is non trivial for us and we don't want to maintain parallel versions. What I would have liked to see is a ValidatedForm and hook wrappers based on the new version so that migration would actually be a migration to the new version with minimum refactoring and presumably solutions for the mentioned issues. |
I don't think I'll be able to dedicate the time to writing a compat layer, but I'm happy to accept a PR for one if you end up making one. Another thing that might help with your migration: when I migrated the test suite I updated the input primitives to be able to accept either an RVF scope or a name string. Here's an example. If you were to update your primitives to that style, then you might find that a surprising number of forms will work out-of-the-box just by updating the imports (at least for simpler forms), while also allowing you to start adopting the new patterns. Here's an example of a test route that didn't need any changes. Migrating that test suite was definitely an exercise in "what's the least amount of code I can change for each form?". It might be worth taking a look. |
What is the new or updated feature that you are suggesting?
I'm wondering if anyone spent the time writing a wrapper for ValidatedForm. We are on the "old" version and have a lot of forms. So migrating to the new is A LOT of work. Ideally, we would want a migration path where the old api wraps the new. I wonder if anyone did that or if it's at all viable. We might have to spend the time to do it ourselves.
Why should this feature be included?
To ease the pain of migrating to a completely new api
The text was updated successfully, but these errors were encountered: