Mithril.js: How to re-enter a route?

Created on 1 Sep 2017  路  7Comments  路  Source: MithrilJS/mithril.js

Just like "window.location.reload()" this function, but do not reload the resource.

Question

Most helpful comment

Oh sorry, your choice of words there was totally fine!

I was pointing out that my workaround is terrible and mithril should provide you a better option than calling m.route.set() twice with a weird-looking param!

All 7 comments

Does m.route.set(m.route.get()) solve your problem?

First thank you for your answer, but it does not work and the page does not respond at all.
My first solution is to enter one other route and then get in it, but it changes history.state. The second is to recall the method that in oninit lifecycle.

Gross hack, but you could call the two other routes with m.route.set("...", null, { replace: true }) which will replace the history entry instead of adding a new one.

Docs on m.route.set's 3rd param

Thank you very much, this is indeed a viable way.

@justb "viable" is a... strong word 馃槗 Glad it's working for you though! An option to force re-match a route when calling m.route.set() doesn't seem outside the realm of possibility. Would be worth filing an issue about if this is functionality that you'd find useful!

馃槗My English is not very good, but i am working on it. Thank you!

Oh sorry, your choice of words there was totally fine!

I was pointing out that my workaround is terrible and mithril should provide you a better option than calling m.route.set() twice with a weird-looking param!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marciomunhoz picture marciomunhoz  路  4Comments

designMoreWeb picture designMoreWeb  路  4Comments

millken picture millken  路  4Comments

josephys picture josephys  路  4Comments

hadihammurabi picture hadihammurabi  路  4Comments