-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Consider removing the autoField
prop
#980
Comments
I was a bit surprised by this. Wouldn't it be more logical that all Forms declare this provider with the default AutoField? And if you would pass That's in my opinion a far less surprising api than the new approach with forcing to wrap all forms with a context-provider. |
The point of this change is to have exactly one API for doing so. We have to implement it somehow, so the context is here to stay. That means the
That'd mean we always have to render the provider and that's not the case now. It probably wouldn't be as much of a problem, but it's always better not to render something if it's not needed.
You're not forced to use this provider in the first place - the library will work correctly without it. Also, you can do it once, at the root of your app - not for each form. |
(We've had a team discussion about this issue, and here are the notes.) We've decided to remove it in v4. |
I noticed deprecation in my code just now. So now I have to load e.g. Unstyled |
Hi @mariusrak,
If you already have your own Hope that helps but feel free to ask more questions if needed. |
But how do I use this custom |
@mariusrak You need to create your own extended uniforms/packages/uniforms/__tests__/AutoForm.tsx Lines 110 to 129 in d557f90
This is because you need to assign that newly created uniforms/packages/uniforms-unstyled/src/QuickForm.tsx Lines 8 to 14 in d557f90
|
Since we introduced
AutoField.componentDetectorContext
in #800 and released it in v3.1.0, theautoField
prop ofQuickForm
(and all its descendant, includingAutoForm
) seems unreasonable. I fully agree with #977 (comment):My point is, that this prop is there just to "initialize" the
AutoField
a given theme will be using. It's used only in one place and could be easily removed. However, when removed, we'll always render the "original"AutoField
of a given theme, which only later will use theAutoField.componentDetectorContext
to choose the component.I believe there are cases where an entirely custom
AutoField
makes sense. But I cannot think of one that would not be possible without theautoField
prop.My idea looks as follows:
autoField
.autoField
by showing a dev-only warning that it's going to be removed in the next major version.I also thought about making the
autoField
prop automatically populate theAutoField.componentDetectorContext
. The problem is that it won't work, we expect a function returning the component in the context, but a component in theautoField
prop.The text was updated successfully, but these errors were encountered: