Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Latest commit

 

History

History
85 lines (48 loc) · 4.91 KB

File metadata and controls

85 lines (48 loc) · 4.91 KB

@radiantguild/form-contexts

0.3.0

Minor Changes

  • #9 406614f Thanks @Alduino! - Added a <NoValidationUpdates> component that disables any validation update calls in its children. See useValidationUpdate’s docs for more info.

0.2.0

Minor Changes

  • #4 56dbc26 Thanks @Alduino! - Added the useInitialValidationUpdate hook, which can be used to have some validation state that will clear when a new one is set.

    The hook was created for the use-case where you have "instant" validation that can respond as a user types in a value, as well as delayed validation that you can only get e.g. when you submit the form.

    You can still use the normal useValidationUpdate hook for instant validation results, but now instead of using that hook for delayed validation, you call useInitialValidationUpdate.

    When using synchronous validation, this hook will act the same as useValidationUpdate (although it acts as a fallback when the standard funtion is called with null).

    If you use asynchronous validation, the hook becomes a bit more fancy, as it can keep showing the initial validation result until the standard one has finished loading. Specifically, it will show until the next loading state finishes.

    Here's a minimal example to give you an idea of how it might be used:

    // serverSideError is set whenever the user clicks a submit button
    useInitialValidationUpdate(props.serverSideError);
    
    // value is the current value of the input, set in an onChange handler
    const validateResult = useValidation(props.value, props.validators);
    useValidationUpdate(validateResult);

Patch Changes

  • 9f5be6a Thanks @Alduino! - useValidationUpdate is now ignored if useInitialValidationUpdate was just called, so that order doesn't matter.

0.2.0-beta.1

Patch Changes

  • 9f5be6a Thanks @Alduino! - useValidationUpdate is now ignored if useInitialValidationUpdate was just called, so that order doesn't matter.

0.2.0-beta.0

Minor Changes

  • #4 56dbc26 Thanks @Alduino! - Added the useInitialValidationUpdate hook, which can be used to have some validation state that will clear when a new one is set.

    The hook was created for the use-case where you have "instant" validation that can respond as a user types in a value, as well as delayed validation that you can only get e.g. when you submit the form.

    You can still use the normal useValidationUpdate hook for instant validation results, but now instead of using that hook for delayed validation, you call useInitialValidationUpdate.

    When using synchronous validation, this hook will act the same as useValidationUpdate (although it acts as a fallback when the standard funtion is called with null).

    If you use asynchronous validation, the hook becomes a bit more fancy, as it can keep showing the initial validation result until the standard one has finished loading. Specifically, it will show until the next loading state finishes.

    Here's a minimal example to give you an idea of how it might be used:

    // serverSideError is set whenever the user clicks a submit button
    useInitialValidationUpdate(props.serverSideError);
    
    // value is the current value of the input, set in an onChange handler
    const validateResult = useValidation(props.value, props.validators);
    useValidationUpdate(validateResult);

0.1.3

Patch Changes

  • aa4b304 Thanks @Alduino! - Split up the validation context to prevent infinite render loops

0.1.2

Patch Changes

0.1.1

Patch Changes

  • bfb4c50 Thanks @Alduino! - Add missing Suspense-using validation that I forgot to implement