Skip to content

Commit bd1b130

Browse files
committed
fix: add check for null resourceId in polymorphic resources
1 parent 1f6f125 commit bd1b130

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

adminforth/modules/restApi.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,15 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
747747

748748
data.data.forEach((item) => {
749749
item[col.name] = targetDataMap[item[col.name]];
750+
751+
if (!item[col.name]) {
752+
if (col.foreignResource && col.foreignResource.polymorphicResources) {
753+
const systemResource = col.foreignResource.polymorphicResources.find(pr => pr.resourceId === null);
754+
if (systemResource) {
755+
item[col.foreignResource.polymorphicOn] = systemResource.whenValue;
756+
}
757+
}
758+
}
750759
});
751760
})
752761
);

0 commit comments

Comments
 (0)