vazco / uniforms

A React library for building forms from any schema.
https://uniforms.tools
MIT License
1.96k stars 243 forks source link

Remove label and placeholder from context and form, add optional provideDefaultLabelFromFieldName property to bridges. #1248

Closed Monteth closed 1 year ago

Monteth commented 1 year ago

Changes are described here: https://github.com/vazco/uniforms/issues/973#issuecomment-1235430047.

This version doesn't include the provideDefaultLabelFromFieldName bridge property in SimpleSchema, since it always delivers a 'label' property. We cannot distinguish whether it was inferred from the field name or entered manually into the schema.

Monteth commented 1 year ago

I run into a problem implementing the provideDefaultLabelFromFieldName functionality in SimpleSchema, you can follow the issue here: https://github.com/longshotlabs/simpl-schema/issues/480

Monteth commented 1 year ago

As I understand, as soon as we migrate to Zod in tests or Simple Schema solves the issue with the labels, we could remove all of these label: '' from tests?

Correct. Since we get rid of label in context, we can no longer tell SimpleSchema not to derive the label from the field name, so we have to pass it explicitly. This behavior is specific to SimpleSchema only.

codecov[bot] commented 1 year ago

Codecov Report

Merging #1248 (8d605b2) into master (cfaf81a) will decrease coverage by 0.97%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1248      +/-   ##
==========================================
- Coverage   97.48%   96.51%   -0.97%     
==========================================
  Files         231      231              
  Lines        3821     3821              
  Branches     1031     1029       -2     
==========================================
- Hits         3725     3688      -37     
- Misses          4       12       +8     
- Partials       92      121      +29     
Impacted Files Coverage Δ
packages/uniforms/src/BaseForm.tsx 100.00% <ø> (ø)
packages/uniforms/src/connectField.tsx 96.55% <ø> (-3.45%) :arrow_down:
packages/uniforms/src/filterDOMProps.ts 100.00% <ø> (ø)
...kages/uniforms-bridge-graphql/src/GraphQLBridge.ts 97.82% <100.00%> (+0.09%) :arrow_up:
...niforms-bridge-json-schema/src/JSONSchemaBridge.ts 100.00% <100.00%> (ø)
...-bridge-simple-schema-2/src/SimpleSchema2Bridge.ts 97.82% <100.00%> (ø)
...rms-bridge-simple-schema/src/SimpleSchemaBridge.ts 100.00% <100.00%> (ø)
packages/uniforms-bridge-zod/src/ZodBridge.ts 100.00% <100.00%> (ø)
packages/uniforms/src/useField.tsx 100.00% <100.00%> (ø)

... and 17 files with indirect coverage changes