From b55c7d5747271b0463256d8a4a02edce2e6f981d Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 29 May 2022 15:01:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BE=9D=E8=B5=96=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E9=A1=BA=E5=BA=8F=EF=BC=8C=E4=BC=98=E5=85=88linux?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/initData.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index a810ccf0..00b99025 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -27,12 +27,11 @@ export default async () => { raw: true, }).then(async (docs) => { const groups = _.groupBy(docs, 'type'); - for (const key in groups) { - if (Object.prototype.hasOwnProperty.call(groups, key)) { - const group = groups[key]; - const depIds = group.map((x) => x.id); - await dependenceService.reInstall(depIds as number[]); - } + const keys = Object.keys(groups).sort((a, b) => parseInt(b) - parseInt(a)); + for (const key of keys) { + const group = groups[key]; + const depIds = group.map((x) => x.id); + await dependenceService.reInstall(depIds as number[]); } });