Skip to content

Fix optional custom field without default value triggering prop types warning

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

This also adds more checks, because currently there is nothing preventing us to use a multiple select but pass only 1 value (and not an array) as default values. I could have used a way more complex PropType to check that is isMulti is true value is either null or an array but I thought it would be better to handle it in the code itself if we ever were to remove PropTypes.

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

Merge request reports