Skip to content

Commit 74c2d22

Browse files
committed
crate.index: Load downloadsContext.version_downloads explicitly with a task
This fixes the following deprecations: - The get method on ember-data's PromiseManyArray is deprecated.
1 parent bb5fc36 commit 74c2d22

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/controllers/crate/version.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class CrateVersionController extends Controller {
2424
this.stackedGraph = false;
2525
}
2626

27-
@alias('downloadsContext.version_downloads.content') downloads;
27+
@alias('loadDownloadsTask.last.value') downloads;
2828
@alias('model.crate') crate;
2929
@alias('model.requestedVersion') requestedVersion;
3030
@alias('model.version') currentVersion;
@@ -62,4 +62,10 @@ export default class CrateVersionController extends Controller {
6262

6363
return readme;
6464
});
65+
66+
// This task would be `perform()` in setupController
67+
loadDownloadsTask = task(async () => {
68+
let downloads = await this.downloadsContext.version_downloads;
69+
return downloads;
70+
});
6571
}

app/routes/crate/version.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ export default class VersionRoute extends Route {
5151
waitForPromise(controller.loadReadmeTask.perform()).catch(() => {
5252
// ignored
5353
});
54+
waitForPromise(controller.loadDownloadsTask.perform()).catch(() => {
55+
// ignored
56+
});
5457

5558
let { crate, version } = model;
5659
if (!crate.documentation || crate.documentation.startsWith('https://docs.rs/')) {

0 commit comments

Comments
 (0)