Skip to content

feat: added unsetValueOnUnmount config - #3815

Merged
logaretm merged 3 commits into
mainfrom
feat/add-config-for-unset-paths
Jul 2, 2022
Merged

feat: added unsetValueOnUnmount config#3815
logaretm merged 3 commits into
mainfrom
feat/add-config-for-unset-paths

Conversation

@logaretm

Copy link
Copy Markdown
Owner

🔎 Overview

This PR adds a configuration to change the automatic behavior of unsetting field values when the components are unmounted.

The configuration is available on both the form level and the field level.

useField('name', undefined, { keepValueOnUnmount: true });

useForm({ keepValuesOnUnmount: true });
<Field name="fieldName" keep-value />

<Form keep-values>
....
</Form>

Issues affected

closes #3795
closes #3607

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #3815 (8efdf95) into main (3d582ec) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3815      +/-   ##
==========================================
+ Coverage   96.46%   96.48%   +0.01%     
==========================================
  Files          68       68              
  Lines        1895     1904       +9     
  Branches      473      479       +6     
==========================================
+ Hits         1828     1837       +9     
  Misses         67       67              
Impacted Files Coverage Δ
packages/vee-validate/src/Field.ts 97.46% <ø> (ø)
packages/vee-validate/src/Form.ts 100.00% <ø> (ø)
packages/vee-validate/src/useField.ts 98.80% <100.00%> (+<0.01%) ⬆️
packages/vee-validate/src/useForm.ts 98.29% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d582ec...8efdf95. Read the comment docs.

@logaretm
logaretm merged commit e6e1c1d into main Jul 2, 2022
@logaretm
logaretm deleted the feat/add-config-for-unset-paths branch July 2, 2022 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure whether field values should be removed from the form due to DOM unmounting Need ability for useField to prevent onBeforeUnmount unregister

2 participants