You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a funny one - if an ID is added to a mask input in a repeater, when items are added they break.
I've not checked other input types, but it might apply beyond masks.
To replicate in the playground:
at first, everything works as expected
add a new item to the repeater
the new item doesn't respect the mask nor populate the form data
In my opinion, this is a question of messaging more than anything else. Duplicated IDs are a bad thing so shouldn't be used, but the current situation of unexplained errors makes debugging the problem very difficult.
Would it be possible to add a console error / warning if IDs are added to repeaters, in order to make this a trivial fix?
Environment
• OS: Mac OS 14.5 (23F79)
• Browser: Chrome Version 125.0.6422.141
• Version: Formkit 1.6
The text was updated successfully, but these errors were encountered:
Ids must always be globally unique (that's just an HTML thing).
Yeah, agree @justin-schroeder - my concern is around the visibility of the issue. It's a pretty straightforward mistake to make, but the error that occurs in FormKit is very unclear - things just stop working.
Would it be possible to add a Javascript error / warning if someone does this to explain what's happened, rather than have fields just fail as in the playground example?
That seems like a reasonable thing to do. In general we try to not put too much additional weight into the bundle to guard for error messages, but we recently added a development build and I think we could improve the error messages that are displayed at development time. I’ll rename this issue to that effect.
justin-schroeder
changed the title
Mask inputs break when IDs are duplicated
Improve error message when duplicate keys are detected (in __DEV__)
Jun 12, 2024
Reproduction
https://formkit.link/4920b90204eb2a0437e463b81dc5e938
Describe the bug
This is a funny one - if an ID is added to a mask input in a repeater, when items are added they break.
I've not checked other input types, but it might apply beyond masks.
To replicate in the playground:
In my opinion, this is a question of messaging more than anything else. Duplicated IDs are a bad thing so shouldn't be used, but the current situation of unexplained errors makes debugging the problem very difficult.
Would it be possible to add a console error / warning if IDs are added to repeaters, in order to make this a trivial fix?
Environment
• OS: Mac OS 14.5 (23F79)
• Browser: Chrome Version 125.0.6422.141
• Version: Formkit 1.6
The text was updated successfully, but these errors were encountered: