diff --git a/mithril.js b/mithril.js index a80cd2f9..014e22ee 100644 --- a/mithril.js +++ b/mithril.js @@ -1783,6 +1783,9 @@ currentTarget = currentTarget.parentNode } + // clear pendingRequests because we want an immediate route change + pendingRequests = 0 + mroute(currentTarget[mroute.mode].slice(modes[mroute.mode].length), args) } diff --git a/tests/unloadingTest.html b/tests/unloadingTest.html new file mode 100644 index 00000000..c3aaf446 --- /dev/null +++ b/tests/unloadingTest.html @@ -0,0 +1,101 @@ + + + + + + Mithril unloading test + + + + + +

This tests unloading of components which have an unloader method.

+

+ The test mounts Component1 on div "one" with a nested internal component and an "open" button. + The internal component displays its creation time and an input field. + The open button when clicked will in turn mount Component2 on div "two" with a close button. + The close button will unmount the second component. +

+

When the second component is mounted or unmounted, the expected behavior is:

+ +

Check the console for logging as to redraws and unload events.

+
+
+ + + +