New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"compare" dirty check compares value to the very first value even after form is reset with new values #791
Comments
Maybe also related to this: #621 |
This will be fixed in the |
@justin-schroeder I created an additional playground, where you can see that the bug is not fixed when a form is used around the field: https://formkit.link/74f80d7df2b2c8c883a2dfbe2594b21e So you can change the value and click submit, inside submit the form is resetet with the new data and both nodes (form + input field) have the dirty flag false. |
This is great, thanks so much for sharing! I am stuck on using this logic for custom formkit component We have a top level FormKit element with 4-5 custom formkit components
How would I go about tracking the "dirty" state value on the custom formkit components in the top level(Parent) component? Is that possible? I was able to see the component state Thank you! |
@dominikklein thanks for your playground! wondering if you know the answer to this ⬆️ ?? |
Thanks for the good reproduction @dominikklein — child initial states are also being reset now in the latest @next. |
Reproduction
https://formkit.com/playground?fkv=latest&fileTab=Playground.vue&files=jc%5B%28%27name%21%27Pqd.vue%27%7Eeditor%21%27%3Cscrip6setupJimpor6%28+jf+%29%C2%A0from+%22vue%221X+ESM+importGarHsupporteYfrom+URLG%7Bhttps%3AXcdn...ZX+aGwell+aGsecondary+pqYfi_G%7B.%2FOtherFi_.vue%7D.Q53jf%7Bnull%7DQ9VA3jf%7B%22a%22Z_6n1QgetNT3%7BnTB3nT05.vA3nT.50conso_.log%7B%225D5.vAZ%291Q93%7BB.9%7B9VA.vAZ%2918scriptJ1%3CzWFormKit4type7se_ct24label7FormKi6Input24help7edi6mHto+ge6started24vA7b24%3Aoptions7%5B%22aD%22bD%22c%22%5D24dirty-behavior7compaj24%40nT7getNT20%2FWinpu6v-mTl79VA2+%2FWbutton+%40click792%3EReset8button%3E00%3CprHv-if752%3E%28%28+5.statH%29%298pjJ8zJ1%3Csty_J%2F*1vanilla+CSS+can+go+hej.1Keep+sty_GscopeYto+avoiYmultiplHfi_s1overwriting+each+other+in+thHjnder+output.1*%2F18sty_J%27%7Eadded%21true%29%5D01++1%5Cn2%5C%273+%3D+40++5context6t+7%3D28%3C%2F9jsetAalueB%7D+%3D%3E+%280nD%22%2C+Gs+He+J%3E1Q1cons6TodeW%3E0%3CX%2F%2FYd+Z%7D1_lejreqlaygrounztemplate%01zqj_ZYXWTQJHGDBA9876543210_&imports=jc%28%27name%21%27ImportMap%27%7Eeditor%21%27%28*+1vue%5C%211https%3A%2F%2Fcdn.jsdelivr.net%2Fnpm%2Fvue%403%2Fdist%2Fvue.esm-browser.min.js0*%29*%27%29*%5Cn0%5C%271+0%0110*_&css-framework=genesis
Describe the bug
I am not sure if it was intended like this or not, but it was unexpected in the context where this bug happened.
If
dirtyBehavior
is set tocompare
, then the value is always compared to the first value that was passed down (and stored asprops._init
). This looks wrong when we callformNode.reset(value)
with different values (which already updatesprops.initial
).To reproduce the behaviour in linked reproduction:
Environment
• OS: any
• Browser any
• Version 0.17.3
The text was updated successfully, but these errors were encountered: