Skip to content

Commit c1c2b46

Browse files
c121914yuFinleyGe
andauthored
fix: initv4141 script (#5967) (#5968)
Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
1 parent 6c759a7 commit c1c2b46

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

projects/app/src/pages/api/admin/initv4141.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,21 @@ async function appSplitMigration(teamId: string) {
108108
const obj = appMap.get(folder._id)!;
109109
const newParentId = obj?.parentId ? appMap.get(obj!.parentId)?.newId : null;
110110

111-
const oldRps = RPMap.get(folder._id)!;
112-
rpOps.push(
113-
...oldRps.map((oldRp) => ({
114-
insertOne: {
115-
document: {
116-
...oldRp,
117-
resourceId: obj.newId!,
118-
_id: undefined
111+
const oldRps = RPMap.get(folder._id);
112+
113+
if (oldRps) {
114+
rpOps.push(
115+
...oldRps.map((oldRp) => ({
116+
insertOne: {
117+
document: {
118+
...oldRp,
119+
resourceId: obj.newId!,
120+
_id: undefined
121+
}
119122
}
120-
}
121-
}))
122-
);
123+
}))
124+
);
125+
}
123126

124127
if (!newParentId) {
125128
continue;

0 commit comments

Comments
 (0)