Skip to content

Commit 23b5d52

Browse files
committed
101623: Fix request being sent with uuid=undefined if not going to a DSO page
1 parent 97c90cf commit 23b5d52

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

src/app/shared/dso-page/dso-edit-menu.resolver.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,32 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
5050
if (hasNoValue(id) && hasValue(route.queryParams.scope)) {
5151
id = route.queryParams.scope;
5252
}
53-
return this.dSpaceObjectDataService.findById(id, true, false).pipe(
54-
getFirstCompletedRemoteData(),
55-
switchMap((dsoRD) => {
56-
if (dsoRD.hasSucceeded) {
57-
const dso = dsoRD.payload;
58-
return combineLatest(this.getDsoMenus(dso, route, state)).pipe(
59-
// Menu sections are retrieved as an array of arrays and flattened into a single array
60-
map((combinedMenus) => [].concat.apply([], combinedMenus)),
61-
map((menus) => this.addDsoUuidToMenuIDs(menus, dso)),
62-
map((menus) => {
63-
return {
64-
...route.data?.menu,
65-
[MenuID.DSO_EDIT]: menus
66-
};
67-
})
68-
);
69-
} else {
70-
return observableOf({...route.data?.menu});
71-
}
72-
})
73-
);
53+
if (hasNoValue(id)) {
54+
// If there's no ID, we're not on a DSO homepage, so pass on any pre-existing menu route data
55+
return observableOf({ ...route.data?.menu });
56+
} else {
57+
return this.dSpaceObjectDataService.findById(id, true, false).pipe(
58+
getFirstCompletedRemoteData(),
59+
switchMap((dsoRD) => {
60+
if (dsoRD.hasSucceeded) {
61+
const dso = dsoRD.payload;
62+
return combineLatest(this.getDsoMenus(dso, route, state)).pipe(
63+
// Menu sections are retrieved as an array of arrays and flattened into a single array
64+
map((combinedMenus) => [].concat.apply([], combinedMenus)),
65+
map((menus) => this.addDsoUuidToMenuIDs(menus, dso)),
66+
map((menus) => {
67+
return {
68+
...route.data?.menu,
69+
[MenuID.DSO_EDIT]: menus
70+
};
71+
})
72+
);
73+
} else {
74+
return observableOf({...route.data?.menu});
75+
}
76+
})
77+
);
78+
}
7479
}
7580

7681
/**

0 commit comments

Comments
 (0)