user3791372
user3791372

Reputation: 4665

mithril.js not loading new pages properly?

I'm not sure if I'm doing something wrong, or if Mithril is. I have a route, say /admin/channels/edit/1. If I were to navigate to /admin/channels/edit/2 nothing is changed. As each route makes a request to an api no new data is requested from the api. I have the initial request being made in an oninit function. Shouldn't the new url force a new request?

Upvotes: 0

Views: 198

Answers (2)

crazy_phage
crazy_phage

Reputation: 548

Here is my guess, you could manually call m.redraw() in your network call if you didn't use the default m.request() function.

Upvotes: 0

Tivac
Tivac

Reputation: 2573

Mithril is re-using the component instance since the routes are technically the same.

There's a useful section in the docs for ways to approach this issue: https://mithril.js.org/route.html#key-parameter

Upvotes: 1

Related Questions