git ssb

16+

Dominic / patchbay



Commit 535b9a31c844497006ff5f0bf0dc391d3df69ae0

fix - navigation quirks

mixmix committed on 7/9/2018, 2:51:45 AM
Parent: a4b0a6f9c734c9e1b63226cf6c9babf790be3048

Files changed

app/page/posts.jschanged
app/sync/goTo.jschanged
app/sync/locationId.jschanged
app/page/posts.jsView
@@ -28,9 +28,9 @@
2828
2929 exports.create = function (api) {
3030 return nest({
3131 'app.html.menuItem': menuItem,
32- 'app.page.posts': postsPage
32 + 'app.page.posts': postsPage,
3333 })
3434
3535 function menuItem () {
3636 return h('a', {
@@ -51,8 +51,9 @@
5151 return computed(state, state => {
5252 var page = byUpdatePage()
5353
5454 page.title = '/posts'
55 + page.id = '{"page": "posts"}' // this is needed because our page is a computed
5556 page.scroll = keyscroll(page.querySelector('section.content'))
5657 return page
5758 })
5859
app/sync/goTo.jsView
@@ -30,27 +30,20 @@
3030
3131 const tabs = api.app.html.tabs()
3232
3333 // currently do normalisation here only to generate normalised locationId
34- api.router.async.normalise(location, (err, location) => {
35- const locationId = api.app.sync.locationId(location)
34 + api.router.async.normalise(location, (err, loc) => {
35 + const locationId = api.app.sync.locationId(loc)
3636
3737 var page = tabs.get(locationId)
3838 if (page) {
3939 tabs.select(locationId)
40 + api.history.sync.push(loc)
4041
41- if (location.value) { // if there's a value it's not just a hydrated locationId
42- if (page && page.firstChild && page.firstChild.scrollDownToMessage) {
43- page.firstChild.scrollDownToMessage(location.key)
44- }
45- }
46-
47- api.history.sync.push(location)
48-
4942 return true
5043 }
5144
52- api.router.async.router(location, (err, page) => {
45 + api.router.async.router(loc, (err, page) => {
5346 if (err) throw err
5447
5548 if (!page) return
5649
@@ -61,11 +54,11 @@
6154 const history = api.history.obs.store()
6255 var _history = history()
6356 var current = _history.pop()
6457
65- history.set([ ..._history, location, current ])
58 + history.set([ ..._history, loc, current ])
6659 } else {
67- api.history.sync.push(location)
60 + api.history.sync.push(loc)
6861 }
6962 })
7063 })
7164 }
app/sync/locationId.jsView
@@ -7,9 +7,9 @@
77 exports.create = function (api) {
88 return nest('app.sync.locationId', locationId)
99
1010 function locationId (location) {
11- if (typeof location === 'string') return string
11 + if (typeof location === 'string') return location
1212
1313 if (isMsg(location.key)) {
1414 // for all messages make the thread root key the 'locationId'
1515 const key = get(location, 'value.content.root', location.key)

Built with git-ssb-web