Bugs

This file was copied from the packages/webapp/src/stories/docs folder. Its accuracy as of August 8, 2024 has not been verified

Known bugs

Not be able to log in through google while in incognito mode

Related github issue

Google api does not support incognito mode

Storybook does not support lazy loading

Related github issue

Examples:

Lazy loaded button

Consent form that uses lazy load on translations

Walk around:
  • In decorator, manually load all translation files,

  • set useSuspense to false,

  • use flag ready to set fallback

// Decorator export default [ (story) => { const { t, ready } = useTranslation( [ 'translation', 'crop', 'common', 'disease', 'task', 'expense', 'fertilizer', 'message', 'gender', 'role', 'harvest_uses', 'soil', ], { useSuspense: false }, ); return ready ? story() : <div>loading</div>; }, ];

Copy

isValid is incorrectly set to false when user click transitioning on add greenhouse page

github issue

Affected pages:
  • Add field garden greenhouse page -> transition date

  • accept invitation and create account page -> name

When input field is type number and is optional, hookform convert empty string to NaN

github issue

This is intended behavior. NaN will be converted to null when it's a number or 0 when it is in jsonb,

When hookform radio value is boolean, defaultChecked does not work on true radio button.

Hookform defaultValues need to be a copy of original object.

const { handleSubmit, watch, control, formState: { errors, isValid }, } = useForm({ mode: 'onChange', defaultValues: {...defaultValuesPassedThroughProp} });

Copy

If defaultValuesPassedThroughProp is passed to defaultValues directly, hookForm will try to delete defaultValuesPassedThroughProp and through errors when defaultValuesPassedThroughProp is inmutable

Hookform does not repopulate radio input field when disabled changes from false to true.

Walk around: reset hookfrom value when disabled is updated
useEffect(() => { if (!props.disabled) { field.onChange(field.value); } }, [props.disabled]);

Copy

Hookform useFormState.errors does not trigger rerendering properly when there are consecutive unit component (bed method)

github discussion

Walk around: delay setValue

Copy

Walk around: force validation on unit component mount. Set show error to false when input is not dirty;

Copy

https://github.com/LiteFarmOrg/LiteFarm/commit/2de64bc75102f99468982a25ff9c081406c15dbc

Frontend tests won't compile when react-icons are imported from 'react-icons/all'

github issue

Walk around: import icons from individual folders instead of "react-icons/all"

Copy

Hookform controlled component with shouldUnregister:false is not validated properly onMount

Walk around: force validation when component is mounted

Copy

Hookform isValid does not update on react select change

Reason unknown

https://github.com/LiteFarmOrg/LiteFarm/compare/bug/hook-form-react-select-validation-error?expand=1

https://5fa09c09b8435e0022120d64-lrowlcggld.chromatic.com/?path=/story/page-task-abandonedtask--primary