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

[FormatMixin] formatting skipped on first render when defined after modelValue #2114

Open
hvdmeulen opened this issue Oct 30, 2023 · 0 comments

Comments

@hvdmeulen
Copy link

hvdmeulen commented Oct 30, 2023

Expected behavior

LionInput formatter logic should be working exactly the same (also on first render) whether defined before or after the modelValue property.

Actual Behavior

Instead, formatter isn't executed on the first render, so when input is not empty on first render , the modelValue stays the unwanted non-formatted value. This seems to be caused by executing the formatting in the requestUpdate phase of the lifecycle, instead of in the updated phase. On first render, in the requestUpdate phase, the formatter property might not be set yet, but the modelValue is set. In this case, formatting is skipped once. It works correctly if the formatter property is defined before the modelValue. See the simple demo, where the order of modelValue and formatter can be changed to see it working or not.

https://studio.webcomponents.dev/edit/oTmMlxximgx4VBRsp68p/README.md?p=README.md

Additional context

Using the latest version of @lion/ui: v0.4.2
LionInput, which uses the FormatMixin mixin, where the bug is in.

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