Skip to content

Multiple Select component + fix optional custom field without default value triggering prop types warning

Nicolas Frandeboeuf requested to merge nicofrand/kresus:multipleSelect into master

This is a new approach to the last commit of !1222 (closed), see !1222 (comment 720692).

This isolates multiple selects from others, simplifying the default values checks and the onChange check. This also renders the default values optional, resolving the PropType issue below.

Also, instead of relying only on the prop types, if default values are provided, the checks for the MultipleSelect are now more robust.

STR:

  1. Go the new access screen
  2. Select "BNP Paribas" (the first)
  3. Look at console: there is the warning below
Warning: Failed prop type: The prop `value` is marked as required in `ConnectFunction`, but its value is `undefined`.
    in ConnectFunction (created by CustomBankField)
    in CustomBankField (created by NewAccessForm)
    in form (created by NewAccessForm)
    in NewAccessForm (created by ConnectFunction)
    in ConnectFunction
    in div
    in div
    in Unknown
    in Route
    in Switch
    in Unknown (created by BaseApp)
    in Route (created by BaseApp)
    in Switch (created by BaseApp)
    in div (created by BaseApp)
    in main (created by BaseApp)
    in BaseApp (created by ConnectFunction)
    in ConnectFunction
    in Unknown (created by ConnectFunction)
    in ConnectFunction
    in Route
    in Switch
    in ErrorReporter
    in Unknown (created by ConnectFunction)
    in ConnectFunction
    in Provider
    in Router (created by BrowserRouter)
    in BrowserRouter
Edited by Nicolas Frandeboeuf

Merge request reports

Loading