Replies: 7 comments
-
@ludbek Could you better clarify what you mean? I'm struggling to see which of these two you're suggesting, if not both:
Keep in mind you could always use
It's an undocumented internal, but for your use case (which isn't idiomatic nor common), you should be okay using it as long as you pin by patch version and pay attention to changes to that file when upgrading. |
Beta Was this translation helpful? Give feedback.
-
What I mean to say is decouple router from auto redraw system. |
Beta Was this translation helpful? Give feedback.
-
@ludbek So both? |
Beta Was this translation helpful? Give feedback.
-
I have started using Mithril and I love it but I also face this issue. For me it would probably be better if I could completely turn off all the automatic redraws and then I would manually trigger A few examples why:
So all my requests and event handlers have redraw disabled and still the website works and redraws. That might be sign of unnecessary redraws to me. Maybe I do something wrong but as it is now all the time I am forced to be aware of automatic redraws and test them to see if multiple redraws occur and if so find the source of these multiple redraws and then to add |
Beta Was this translation helpful? Give feedback.
-
Related discussions: #2148, #2179 (in subsequent discussion) |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I'll note that the way I changed it in #2458 could make it possible to expose a component. One could imagine // This is now also a closure component.
var route = function(root, defaultRoute, routes) {
// At the beginning:
var redraw = mountRedraw.redraw
if (root.tag === route) {
assign(routes = {}, root.attrs)
redraw = routes.redraw || redraw
defaultRoute = routes.defaultRoute
delete routes.redraw
delete routes.defaultRoute
}
// Then the body, just with the few occurrences of `mountRedraw.redraw()` +
// `mountRedraw.redraw.sync()` replaced with `redraw` and `redraw.sync()`
// respectively.
// At the end:
var inst = {
// The component currently mounted, with all the current data.
}
return root.tag === route ? inst : mountRedraw.mount(root, inst)
} |
Beta Was this translation helpful? Give feedback.
-
Problem
Mithril has auto redraw system based upon dom and other events. So one has two different ways to redraw Mithril app
1. dom events
2. m.render
There are situations where one has to skip auto redraw and trigger redraw after a state changes. To me (and new comers) its an overhead to be aware of two different ways to redraw. The auto redraw system is completely redundant with tools like mobx.
m.route
has great api. Unfortunately it usesm.mount
by default.Solution
It would be great to have an option to make
m.route
work withm.render
.Beta Was this translation helpful? Give feedback.
All reactions