add null check

This commit is contained in:
Mads Rasmussen
2024-01-09 15:44:13 +01:00
parent d6c62b822d
commit a0ad88015a
3 changed files with 9 additions and 9 deletions

View File

@@ -33,14 +33,14 @@ export class UmbPartialViewTreeServerDataSource extends UmbTreeServerDataSourceB
const getRootItems = () => PartialViewResource.getTreePartialViewRoot({});
const getChildrenOf = (parentUnique: string | null) => {
const serializer = new UmbServerPathUniqueSerializer();
const parentPath = new UmbServerPathUniqueSerializer().toServerPath(parentUnique);
if (parentUnique === null) {
if (parentPath === null) {
return getRootItems();
} else {
// eslint-disable-next-line local-rules/no-direct-api-import
return PartialViewResource.getTreePartialViewChildren({
parentPath: serializer.toServerPath(parentUnique),
parentPath,
});
}
};

View File

@@ -33,14 +33,14 @@ export class UmbScriptTreeServerDataSource extends UmbTreeServerDataSourceBase<
const getRootItems = () => ScriptResource.getTreeScriptRoot({});
const getChildrenOf = (parentUnique: string | null) => {
const serializer = new UmbServerPathUniqueSerializer();
const parentPath = new UmbServerPathUniqueSerializer().toServerPath(parentUnique);
if (parentUnique === null) {
if (parentPath === null) {
return getRootItems();
} else {
// eslint-disable-next-line local-rules/no-direct-api-import
return ScriptResource.getTreeScriptChildren({
parentPath: serializer.toServerPath(parentUnique),
parentPath,
});
}
};

View File

@@ -33,14 +33,14 @@ export class UmbStylesheetTreeServerDataSource extends UmbTreeServerDataSourceBa
const getRootItems = () => StylesheetResource.getTreeStylesheetRoot({});
const getChildrenOf = (parentUnique: string | null) => {
const serializer = new UmbServerPathUniqueSerializer();
const parentPath = new UmbServerPathUniqueSerializer().toServerPath(parentUnique);
if (parentUnique === null) {
if (parentPath === null) {
return getRootItems();
} else {
// eslint-disable-next-line local-rules/no-direct-api-import
return StylesheetResource.getTreeStylesheetChildren({
parentPath: serializer.toServerPath(parentUnique),
parentPath,
});
}
};