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

iMask options not updating when new options are a partial of the existing options #1073

Open
JSMike opened this issue Aug 30, 2024 · 0 comments

Comments

@JSMike
Copy link

JSMike commented Aug 30, 2024

Describe the bug

Logical bug in core library that prevents mask options from updating when new options are a partial of the existing options.

Use case:
Formatted input with show/hide toggle

When wanting to show the values of an input field that are currently hidden by changing the imask blocks configuration, imask fails to update options because of current logic to only apply changes when the new option key/values all existed in the previous, this logic does not pick up when there are omissions.

The logical issue is in updateOptions which calls optionsIsChanged which assumes the options have changed only if they don't exist in the current mask. This doesn't account for if some of the options have been removed, and returns false when the options have changed.

To Reproduce

https://stackblitz.com/edit/stackblitz-starters-ex7edc?file=src%2Fmain.ts

Expected behavior

When new options are passed that are a partial of the previous options then only the new options should apply and any configuration that was removed should not persist.

Environment:

  • OS: All
  • Browser All
  • Version: Current
  • IMask version: 7.6.1
  • Framework/plugin version if used: Angular (but issue is with core library)

Additional context

Adding unique keys, or changing the structure of the object resolves the issue, but it is not clear that a change like this is required to apply a new mask.

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

No branches or pull requests

1 participant