Fix dashboard hanging when loading app from contributor URL

Loading the app from /dashboard/contributors/:id is failing, because the
contributors are loaded later. This fetches the requested contributor
separately when launching the app from a contributor profile URL.
This commit is contained in:
Râu Cao
2023-01-15 13:57:13 +08:00
parent 854402aa73
commit fe3816501c
2 changed files with 13 additions and 1 deletions
+7 -1
View File
@@ -8,7 +8,13 @@ export default Route.extend({
contributors: alias('kredits.contributors'),
model (params) {
return this.contributors.findBy('id', params.id);
const contributor = this.contributors.findBy('id', params.id);
if (contributor) {
return contributor;
} else {
return this.kredits.fetchContributor(params.id);
}
},
setupController (controller, model) {