Skip to content

Commit 43af389

Browse files
committed
Fixed a small bug where org could be clicked before everything is loaded
1 parent 5736666 commit 43af389

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/components/home/OrgList.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export default {
4242
},
4343
methods: {
4444
viewOrg(name) {
45-
this.$router.push({ name: "orgView", params: { name: name } });
45+
if(this.$store.state.isOrgLoaded[name])
46+
this.$router.push({ name: "orgView", params: { name: name } });
4647
}
4748
}
4849
};

src/components/org/OrgContributors.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export default {
4141
},
4242
methods: {
4343
async load(cutoff) {
44+
//Set org status as loading
45+
this.$store.commit("SET_ORG_STATUS", {orgName: this.orgName, status: false})
46+
4447
let topContributors = [];
4548
const orgRepos = await this.getRepos();
4649
@@ -89,6 +92,7 @@ export default {
8992
cutoff--;
9093
}
9194
this.isLoading = false;
95+
this.$store.commit("SET_ORG_STATUS", {orgName: this.orgName, status: true});
9296
},
9397
async getRepos() {
9498
const res = await axios

src/store.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export default new Vuex.Store({
1717
topCommits: [],
1818
topWeekCommits: [],
1919
topMonthCommits: [],
20-
topYearCommits: []
20+
topYearCommits: [],
21+
isOrgLoaded: []
2122
},
2223
mutations: {
2324
SET_USER(state, user) {
@@ -43,6 +44,9 @@ export default new Vuex.Store({
4344
},
4445
SET_TOP_YEAR_COMMITS(state, topYearCommits) {
4546
state.topYearCommits = topYearCommits;
47+
},
48+
SET_ORG_STATUS(state, payload) {
49+
state.isOrgLoaded[payload.orgName] = payload.status;
4650
}
4751
},
4852
actions: {

0 commit comments

Comments
 (0)