Commit 535b9a31c844497006ff5f0bf0dc391d3df69ae0
fix - navigation quirks
mixmix committed on 7/9/2018, 2:51:45 AMParent: a4b0a6f9c734c9e1b63226cf6c9babf790be3048
Files changed
app/page/posts.js | changed |
app/sync/goTo.js | changed |
app/sync/locationId.js | changed |
app/page/posts.js | ||
---|---|---|
@@ -28,9 +28,9 @@ | ||
28 | 28 … | |
29 | 29 … | exports.create = function (api) { |
30 | 30 … | return nest({ |
31 | 31 … | 'app.html.menuItem': menuItem, |
32 | - 'app.page.posts': postsPage | |
32 … | + 'app.page.posts': postsPage, | |
33 | 33 … | }) |
34 | 34 … | |
35 | 35 … | function menuItem () { |
36 | 36 … | return h('a', { |
@@ -51,8 +51,9 @@ | ||
51 | 51 … | return computed(state, state => { |
52 | 52 … | var page = byUpdatePage() |
53 | 53 … | |
54 | 54 … | page.title = '/posts' |
55 … | + page.id = '{"page": "posts"}' // this is needed because our page is a computed | |
55 | 56 … | page.scroll = keyscroll(page.querySelector('section.content')) |
56 | 57 … | return page |
57 | 58 … | }) |
58 | 59 … |
app/sync/goTo.js | |||
---|---|---|---|
@@ -30,27 +30,20 @@ | |||
30 | 30 … | ||
31 | 31 … | const tabs = api.app.html.tabs() | |
32 | 32 … | ||
33 | 33 … | // 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) | ||
36 | 36 … | ||
37 | 37 … | var page = tabs.get(locationId) | |
38 | 38 … | if (page) { | |
39 | 39 … | tabs.select(locationId) | |
40 … | + api.history.sync.push(loc) | ||
40 | 41 … | ||
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 | - | ||
49 | 42 … | return true | |
50 | 43 … | } | |
51 | 44 … | ||
52 | - api.router.async.router(location, (err, page) => { | ||
45 … | + api.router.async.router(loc, (err, page) => { | ||
53 | 46 … | if (err) throw err | |
54 | 47 … | ||
55 | 48 … | if (!page) return | |
56 | 49 … | ||
@@ -61,11 +54,11 @@ | |||
61 | 54 … | const history = api.history.obs.store() | |
62 | 55 … | var _history = history() | |
63 | 56 … | var current = _history.pop() | |
64 | 57 … | ||
65 | - history.set([ ..._history, location, current ]) | ||
58 … | + history.set([ ..._history, loc, current ]) | ||
66 | 59 … | } else { | |
67 | - api.history.sync.push(location) | ||
60 … | + api.history.sync.push(loc) | ||
68 | 61 … | } | |
69 | 62 … | }) | |
70 | 63 … | }) | |
71 | 64 … | } |
app/sync/locationId.js | ||
---|---|---|
@@ -7,9 +7,9 @@ | ||
7 | 7 … | exports.create = function (api) { |
8 | 8 … | return nest('app.sync.locationId', locationId) |
9 | 9 … | |
10 | 10 … | function locationId (location) { |
11 | - if (typeof location === 'string') return string | |
11 … | + if (typeof location === 'string') return location | |
12 | 12 … | |
13 | 13 … | if (isMsg(location.key)) { |
14 | 14 … | // for all messages make the thread root key the 'locationId' |
15 | 15 … | const key = get(location, 'value.content.root', location.key) |
Built with git-ssb-web