-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Throw dev mode exception when a keyed each has duplicate keys #4301
Comments
We use The implementation of To add a dev-mode-only check for the
If it is the first time that you contribute to Svelte, follow these steps:
You can read our Contributing Guide to learn more. |
It turned out that |
Saw your branch, looks good to me |
Did you mean to remove the |
It's an unrelated change, but I did intend to remove it. It's not used anywhere (I'm not sure when it last was), and it seems unrelated to the other keyed each stuff in the file. |
Also see #4234, which has the same root cause. |
Is your feature request related to a problem? Please describe.
Duplicate keys in a keyed each can cause confusing runtime errors.
Describe the solution you'd like
A dev-mode-only check for
Describe alternatives you've considered
Making keyed eaches behave better when there are duplicate keys sounds like a lot of work and probably not a good idea anyway.
The only alternative I've really considered (besides doing nothing) is to run this check all the time with keyed eaches, not just in dev mode. But this would be a) more code for people whose apps are already working fine, and b) more work for the browser to do. I think this makes the most sense as a dev mode error (or possibly a dev mode warning).
How important is this feature to you?
It'd be nice. It shouldn't be too hard (I have it basically working locally), and it doesn't introduce any extra cost to people in prod mode.
Additional context
See #4244.
The text was updated successfully, but these errors were encountered: