git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit 72d67ba07462592fcaf199c43c5b8b6547032788

fix "Cannot read property 'childNodes' of null" issue

fixes #3
Matt McKegg committed on 2/20/2017, 3:52:21 AM
Parent: 69b484ecf905bda074b7eacb6d2d8b5d31047c00

Files changed

main-window.jschanged
package.jsonchanged
main-window.jsView
@@ -71,9 +71,9 @@
7171
7272 var lastViewed = {}
7373 var defaultViews = views.keys()
7474
75- // delete cached view after 30 mins of last seeing
75+ // delete cached view after 5 mins of last seeing
7676 setInterval(() => {
7777 views.keys().forEach((view) => {
7878 if (!defaultViews.includes(view)) {
7979 if (lastViewed[view] !== true && Date.now() - lastViewed[view] > (5 * 60e3) && view !== currentView()) {
@@ -86,9 +86,11 @@
8686 var canGoForward = Value(false)
8787 var canGoBack = Value(false)
8888 var currentView = Value('/public')
8989
90- var mainElement = h('div.main', MutantMap(toCollection(views), (item) => {
90+ var viewCollection = toCollection(views)
91+
92+ var mainElement = h('div.main', MutantMap(viewCollection, (item) => {
9193 return h('div.view', {
9294 hidden: computed([item.key, currentView], (a, b) => a !== b)
9395 }, [ item.value ])
9496 }))
@@ -190,19 +192,32 @@
190192 }
191193
192194 function goBack () {
193195 if (backHistory.length) {
196+
194197 canGoForward.set(true)
195198 forwardHistory.push(currentView())
196- currentView.set(backHistory.pop())
199+
200+ var view = backHistory.pop()
201+ if (!views.has(view)) {
202+ views.put(view, renderPage(view))
203+ }
204+
205+ currentView.set(view)
197206 canGoBack.set(backHistory.length > 0)
198207 }
199208 }
200209
201210 function goForward () {
202211 if (forwardHistory.length) {
203212 backHistory.push(currentView())
204- currentView.set(forwardHistory.pop())
213+
214+ var view = forwardHistory.pop()
215+ if (!views.has(view)) {
216+ views.put(view, renderPage(view))
217+ }
218+
219+ currentView.set(view)
205220 canGoForward.set(forwardHistory.length > 0)
206221 canGoBack.set(true)
207222 }
208223 }
package.jsonView
@@ -28,9 +28,9 @@
2828 "is-visible": "^2.1.1",
2929 "level": "~1.4.0",
3030 "level-memview": "0.0.0",
3131 "micro-css": "^1.0.0",
32- "mutant": "^3.15.1",
32+ "mutant": "^3.15.2",
3333 "mutant-pull-reduce": "^1.0.1",
3434 "non-private-ip": "^1.4.1",
3535 "on-change-network": "0.0.2",
3636 "on-wakeup": "^1.0.1",

Built with git-ssb-web