fix flake id users not fetching correctly

user-search-better-error-handling
Henry Jameson 6 years ago
parent 885a3a77df
commit 6420c93e98

@ -68,7 +68,8 @@ const UserProfile = {
}, },
userInStore () { userInStore () {
const routeParams = this.$route.params const routeParams = this.$route.params
return this.$store.getters.findUser(routeParams.name || routeParams.id) // This needs fetchedUserId so that computed will be refreshed when user is fetched
return this.$store.getters.findUser(this.fetchedUserId || routeParams.name || routeParams.id)
}, },
user () { user () {
if (this.timeline.statuses[0]) { if (this.timeline.statuses[0]) {

@ -133,7 +133,14 @@ export const mutations = {
} }
export const getters = { export const getters = {
findUser: state => query => state.usersObject[typeof query === 'string' ? query.toLowerCase() : query] findUser: state => query => {
const result = state.usersObject[query]
// In case it's a screen_name, we can try searching case-insensitive
if (!result && typeof query === 'string') {
return state.usersObject[query.toLowerCase()]
}
return result
}
} }
export const defaultState = { export const defaultState = {

Loading…
Cancel
Save