Replies: 7 comments
-
Adding a check for this isn't hard, but it would add overhead in probably the most perf-sensitive function of the render engine. We may or may not add it depending on how much it affects perf... |
Beta Was this translation helpful? Give feedback.
-
this is a devmode-only thing (if mithril has one). in production builds this would destroy performance. |
Beta Was this translation helpful? Give feedback.
-
Might be worth adding this to the bucket list of "if Mithril did warnings". For a while we've been talking about "gotchas" as distinct from the "anti-patterns" detailed in the documentation. In the distant future, when other meta-repo issues have been addressed, a policy of liberal warnings in source, along with a build step that stripped out the code paths, would be a nice idea. |
Beta Was this translation helpful? Give feedback.
-
We don't, although I've recommended it multiple times in the past in various channels. |
Beta Was this translation helpful? Give feedback.
-
Stripping code from builds isn't difficult, though with mithril's custom bundler everything is a bit trickier than it should be. 😅 |
Beta Was this translation helpful? Give feedback.
-
Devmode publishing seems like a thing that should be done right, if at all. Since the point would be to keep the warnings only in development, that means that consumers should essentially need to be able to selectively strip out the code themselves, or then switch source files in their build automatically. There's probably some established patterns for this, my main point is that module consumers need to be able to include both devmode and prodmode in their tools, and ideally getting there without being forced to put more tools in their build config. So end result being that there basically should be four different source sets to consume, unless I'm missing something. |
Beta Was this translation helpful? Give feedback.
-
Perhaps the minified version (can be the With the unminified version (can be a This would solve the user having to do any custom build setups. |
Beta Was this translation helpful? Give feedback.
-
I did my first Mithril app earlier this week, and spent 3 hours debugging why I was getting super bizarre behaviour. It turned out that I had
Data.items.list.find(i => i.id = id)
instead ofData.items.list.find(i => i.id == id)
, which was then later rendered like so:It would be really nice if Mithril emitted a warning if the children array contains non-unique key values. If such a thing existed, it would been reduced from 3 hours of debugging to a few minutes.
Beta Was this translation helpful? Give feedback.
All reactions