From b1d948beccfa81ccd037c6dbbc301cf96a194f6d Mon Sep 17 00:00:00 2001 From: David Sevilla Martin Date: Tue, 11 Aug 2020 11:43:49 -0400 Subject: [PATCH] revert patchMithril changes for all links to re-call oninit --- js/src/common/utils/patchMithril.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/js/src/common/utils/patchMithril.js b/js/src/common/utils/patchMithril.js index 29d7232f4..e2e47016f 100644 --- a/js/src/common/utils/patchMithril.js +++ b/js/src/common/utils/patchMithril.js @@ -16,14 +16,6 @@ export default function patchMithril(global) { * Please note that any code that manually calls m.route.set will need to provide something like this to the * options parameter itself. Patching m.route.set would be more convenient, but would too severely restrict flexibility. */ - const defaultLinkView = defaultMithril.route.Link.view; - const modifiedLink = { - view: function (vnode) { - if (!vnode.attrs.options) vnode.attrs.options = { state: { key: Date.now() } }; - - return defaultLinkView(vnode); - }, - }; const modifiedMithril = function (comp, ...args) { const node = defaultMithril.apply(this, arguments); @@ -39,7 +31,7 @@ export default function patchMithril(global) { // supports linking to other pages in the SPA without refreshing the document. if (node.attrs.route) { node.attrs.href = node.attrs.route; - node.tag = modifiedLink; + node.tag = modifiedMithril.route.Link; // For some reason, m.route.Link does not like vnode.text, so if present, we // need to convert it to text vnodes and store it in children. @@ -55,8 +47,6 @@ export default function patchMithril(global) { Object.keys(defaultMithril).forEach((key) => (modifiedMithril[key] = defaultMithril[key])); - modifiedMithril.route.Link = modifiedLink; - modifiedMithril.stream = Stream; global.m = modifiedMithril;