Skip to content

Commit 2f3530c

Browse files
committed
[[wm]] made the current package a mithril keyed component, this makes sure it redraws in case any of its attributes changes.
1 parent cec41a8 commit 2f3530c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ui/wm.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ let useShortColumn = true
88
let currentView = false
99
let currentPackage = false
1010
let args = {}
11+
let key = Date.now()
1112

1213
patchfox.listen("package:changed", (event, data) => {
1314
console.log(`package changed to "${data.packageToOpen.name}.${data.view}"`)
@@ -72,9 +73,10 @@ patchfox.listen("package:go", (event, { pkg, view, data }) => {
7273
state.identity = cs.identity
7374
}
7475
let qs = queryString.stringify(state)
75-
history.pushState({ pkg, view, data }, "", path.join(__dirname, `index.html?${qs}`))
76+
history.pushState({ pkg, view, data }, "", path.join(process.cwd(), `/ui/index.html?${qs}`))
7677
console.log(`going to ${pkg}.${view} with args`, data)
7778
goPackage({ pkg, view, data })
79+
key = Date.now()
7880
m.redraw()
7981
window.scrollTo(0,0)
8082
})
@@ -111,8 +113,8 @@ const Wm = {
111113
// system packages
112114
...systemPackages.map(pkg => m(pkg.view)),
113115
// app package or current package
114-
currentPackage?.app ? m(".container.wm-current-app-container.container.mx-auto", m(currentView, {...args})) :
115-
m(".wm-current-package-container.p-2", m(".wm-current-package", m(currentView, {...args}))),
116+
currentPackage?.app ? m(".container.wm-current-app-container.container.mx-auto", m(currentView, {key, ...args})) :
117+
m(".wm-current-package-container.p-2", m(".wm-current-package", m(currentView, {key, ...args}))),
116118
m("div", {style: {height: "40px"}})
117119
])
118120
)

0 commit comments

Comments
 (0)