Skip to content
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

Ignore value feature #95

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MichaelWest22
Copy link
Collaborator

Here is a possible new feature we can add. We already have support to ignore the value of the active element. This existing feature allow you to morph say a form with inputs to a new state but it will not update the contents of the item the user is currently focused on and entering input into. However for all other inputs in the same form their current values will need to passed back to the server and returned as they are in the response that gets morphed in so that the state of the other inputs can be preserved. This probably works well for most cases. But it would also be nice to support a more generic value preserving option like this IgnoreValue option where instead it can preserve ALL inputs, checkboxes and textarea's with the current DOM entry state. I found this feature mainly useful when testing form replacement and mutations on the client side as I didn't have a server interaction to submit and recreate the input values. I do not know if there is wider demand for this feature outside of this so feel free to ignore and close this PR

@MichaelWest22
Copy link
Collaborator Author

Found this issue #27 that has a similar suggestion and need for this same feature. There is a suggestion in this issue to re-write the sync input code and remove and simplify most of the logic to handle situations where inputs have been changed by end users but not the attributes themselves. But this is likely a breaking change for some users so would have to be added as an option. But my solution here also seems to cover their use case well and I think is less likely to risk causing issues as my change allows you to override all input value swapping if this is the requirement instead of tring to do a smarter optional attribute comparision.

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.

1 participant