-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fabo/1199 improve jank at start #1216
Changes from all commits
da0480b
e47355b
be87061
e3c09c6
e9c2bbb
91e1ad5
38419d8
90303bf
f4d4955
2642e52
210d188
8071db3
1abce16
7de4e7e
8265ef8
c7540b5
a2aed76
e154adb
b9e59e1
bfd4404
db24e64
4a83535
69285d0
4d27f2c
fcfae87
75afc9c
530abce
37013b0
c189995
7f09233
305a66a
74d88c6
1e9b89f
68f3b15
5a69633
6fdf2ce
8db9b3e
fb9bc87
b72875e
a46a34a
07b1a4a
9c317c3
c12de6b
3c1e45c
c6d8125
07a3ade
5f46e73
f35b03b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import axios from "axios" | ||
|
||
export default ({}) => { | ||
const emptyState = { | ||
identities: {}, | ||
loading: false | ||
} | ||
const state = JSON.parse(JSON.stringify(emptyState)) | ||
|
||
const mutations = { | ||
setKeybaseIdentities(state, identities) { | ||
identities.forEach(identity => { | ||
state.identities[identity.keybaseId] = identity | ||
}) | ||
} | ||
} | ||
|
||
const actions = { | ||
async getKeybaseIdentity({ state }, keybaseId) { | ||
if (!/.{16}/.test(keybaseId)) return // the keybase id is not correct | ||
if (state.identities[keybaseId]) return // we already have this identity | ||
|
||
let urlPrefix = | ||
"https://keybase.io/_/api/1.0/user/lookup.json?key_suffix=" | ||
let fullUrl = urlPrefix + keybaseId | ||
let json = await axios.get(fullUrl) | ||
if (json.data.status.name === "OK") { | ||
let user = json.data.them[0] | ||
if (user && user.pictures && user.pictures.primary) { | ||
return { | ||
keybaseId, | ||
avatarUrl: user.pictures.primary.url, | ||
userName: user.basics.username, | ||
profileUrl: "https://keybase.io/" + user.basics.username | ||
} | ||
} | ||
} | ||
}, | ||
async getKeybaseIdentities({ dispatch, commit }, validators) { | ||
return Promise.all( | ||
validators.map(async validator => { | ||
if (validator.description.identity) { | ||
return dispatch( | ||
"getKeybaseIdentity", | ||
validator.description.identity | ||
) | ||
} | ||
}) | ||
).then(identities => { | ||
commit("setKeybaseIdentities", identities.filter(x => !!x)) | ||
}) | ||
} | ||
} | ||
|
||
return { | ||
state, | ||
actions, | ||
mutations | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,11 @@ export default function({ node }) { | |
rootState.wallet.zoneIds.unshift(header.chain_id) | ||
} | ||
|
||
await dispatch("maybeUpdateValidators", header) | ||
// updating the header is done even while the user is not logged in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we do this / is this still true? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, we bind to the "new header" events before signing in. the event would then trigger an update of the validatorset which is skipped here. This will also change when we react to the validatorset updated event. |
||
// to prevent errors popping up from the LCD before the user is signed on, we skip updating validators before | ||
// TODO identify why rest calls fail at this point | ||
if (rootState.user.signedIn) | ||
await dispatch("maybeUpdateValidators", header) | ||
}, | ||
async reconnect({ commit }) { | ||
if (state.stopConnecting) return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed monikers not showing