Skip to content
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

Property 'options' does not exist on <SelectField /> (uniforms-semantic) #806

Closed
kestarumper opened this issue Sep 23, 2020 · 5 comments · Fixed by #1229
Closed

Property 'options' does not exist on <SelectField /> (uniforms-semantic) #806

kestarumper opened this issue Sep 23, 2020 · 5 comments · Fixed by #1229
Assignees
Labels
Area: Theme Affects some of the theme packages Theme: AntD Affects the uniforms-antd package Theme: Bootstrap 3 Affects the uniforms-bootstrap3 package Theme: Bootstrap 4 Affects the uniforms-bootstrap4 package Theme: Bootstrap 5 Affects the uniforms-bootstrap5 package Theme: Material-UI Affects the uniforms-material package Theme: MUI Affects the uniforms-mui package Theme: Semantic UI Affects the uniforms-semantic package Theme: Unstyled Affects the uniforms-unstyled package Type: Feature New features and feature requests
Milestone

Comments

@kestarumper
Copy link
Member

Type '{ name: string; options: { label: string; value: string; }[]; onChange: (repositoryId: string) => void; }' is not assignable to type 'IntrinsicAttributes & { label?: ReactNode; name: string; placeholder?: string | boolean | null | undefined; } & Pick<Partial<GuaranteedProps<string | string[] | undefined>>, "id" | ... 9 more ... | "showInlineError"> & Pick<...> & { ...; }'.
  Property 'options' does not exist on type 'IntrinsicAttributes & { label?: ReactNode; name: string; placeholder?: string | boolean | null | undefined; } & Pick<Partial<GuaranteedProps<string | string[] | undefined>>, "id" | ... 9 more ... | "showInlineError"> & Pick<...> & { ...; }'.

Versions:

  • uniforms 3.0.0-rc3
  • uniforms-semantic 3.0.0-rc3

Description:
Property options do not exist but are used to calculate allowedValues. The only problem is that they're missing in the typescript definitions.

@radekmie radekmie added this to Needs triage in Open Source (migrated) Sep 23, 2020
@kestarumper kestarumper self-assigned this Sep 23, 2020
@kestarumper kestarumper added the Type: Bug Bug reports and their fixes label Sep 23, 2020
@kestarumper kestarumper moved this from Needs triage to To do in Open Source (migrated) Sep 23, 2020
@kestarumper kestarumper moved this from To do to In progress in Open Source (migrated) Sep 30, 2020
@radekmie
Copy link
Contributor

As this topic arose once again (internally), I thought it'd be great to describe the problem (I'm sure I already did that but there's no comment here).

All props received by a field created with connectField (or directly using useField) are extended with the ones from a bridge method called getProps. All of the standard bridges understand the options prop (e.g., JSONSchemaBridge#getProps code), but a new or custom bridge may not. Technically speaking, we'd need to have a way, to extend props (their types) from the bridge.

@radekmie radekmie added this to the v3.x milestone Feb 10, 2021
@radekmie radekmie moved this from In progress to To do in Open Source (migrated) Mar 8, 2021
@kestarumper kestarumper moved this from To do to In progress in Open Source (migrated) Aug 11, 2021
@radekmie radekmie moved this from In progress to To do in Open Source (migrated) Sep 29, 2021
@radekmie
Copy link
Contributor

We'll leave it for now, as there's no easy way of handling it.

@radekmie
Copy link
Contributor

Instead of using allowedValues as defined in #862, we'll use options prop instead. And it won't be resolved on the bridge level, but on the field instead.

@radekmie radekmie modified the milestones: v3.x, v4.0 Dec 10, 2021
@radekmie radekmie added Type: Feature New features and feature requests and removed Type: Bug Bug reports and their fixes labels Dec 10, 2021
@radekmie radekmie self-assigned this Feb 3, 2022
@radekmie radekmie added Area: Theme Affects some of the theme packages Theme: AntD Affects the uniforms-antd package Theme: Bootstrap 3 Affects the uniforms-bootstrap3 package Theme: Bootstrap 4 Affects the uniforms-bootstrap4 package Theme: Bootstrap 5 Affects the uniforms-bootstrap5 package Theme: Material-UI Affects the uniforms-material package Theme: MUI Affects the uniforms-mui package Theme: Semantic UI Affects the uniforms-semantic package Theme: Unstyled Affects the uniforms-unstyled package labels Jun 10, 2022
@radekmie radekmie moved this from To do to Concept in Open Source (migrated) Jul 15, 2022
@kestarumper kestarumper assigned kestarumper and unassigned radekmie Aug 26, 2022
@kestarumper
Copy link
Member Author

We've discussed this, and there will be changes on the bridge level, as @radekmie mentioned above.

Breaking changes

We'll be removing allowedValues and transform properties. Fields will only use options property.

The common API

Bridges will use

type Option = {
    disabled?: boolean;
    key?: string
    label?: string;
    value: unknown;
}

(similar as described in #862)

Fields

Fields should also follow this format but can also extend it for custom use cases.
For example, the field can assume that the value: unknown is of type value: string in SemanticUI but will be different value: string | number in AntD. One might also extend the type and add other properties as well (field level).

Migrating

  • Usage of allowedValues and transform should be replaced with options
  • SimpleSchema allowed you to provide a function for the options property - you will be able to retain this by converting that function to a getter using get keyword.

@kestarumper
Copy link
Member Author

Closes #1120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Theme Affects some of the theme packages Theme: AntD Affects the uniforms-antd package Theme: Bootstrap 3 Affects the uniforms-bootstrap3 package Theme: Bootstrap 4 Affects the uniforms-bootstrap4 package Theme: Bootstrap 5 Affects the uniforms-bootstrap5 package Theme: Material-UI Affects the uniforms-material package Theme: MUI Affects the uniforms-mui package Theme: Semantic UI Affects the uniforms-semantic package Theme: Unstyled Affects the uniforms-unstyled package Type: Feature New features and feature requests
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants