Skip to content

Commit

Permalink
fix: package detail don't get fully updated after url change
Browse files Browse the repository at this point in the history
  • Loading branch information
favoyang committed Dec 15, 2019
1 parent ae40db5 commit e9b3a5f
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions docs/.vuepress/theme/layouts/PackageDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,22 @@ const apiRepoUrl = "https://api.github.com/repos/";
const apiPackageUrl = urljoin(util.apiUrl, "/packages/");
const openupmCliRepoUrl = "https://github.com/openupm/openupm-cli#openupm-cli";
const defaultData = function() {
return {
readmeRaw: "",
repoInfo: {},
packageInfo: {},
noTagsFound: false,
openupmCliRepoUrl
};
};
export default {
components: { ParentLayout, NavLink },
data() {
return {
readmeRaw: "",
repoInfo: {},
packageInfo: {},
noTagsFound: false,
openupmCliRepoUrl: "https://github.com/openupm/openupm-cli#openupm-cli"
};
return defaultData();
},
computed: {
$package() {
Expand Down Expand Up @@ -327,13 +333,23 @@ export default {
};
}
},
watch: {
// eslint-disable-next-line no-unused-vars
$route(to, from) {
Object.assign(this.$data, defaultData());
this.onStart();
}
},
mounted() {
this.fetchRepoReadme();
this.fetchRepoInfo();
this.fetchRepoTagsInfo();
this.fetchPackageInfo();
this.onStart();
},
methods: {
onStart() {
this.fetchRepoReadme();
this.fetchRepoInfo();
this.fetchRepoTagsInfo();
this.fetchPackageInfo();
},
async fetchRepoReadme() {
// Fetch repo readme.
const title = "# " + this.packageName + "\n";
Expand Down

0 comments on commit e9b3a5f

Please sign in to comment.