This commit is contained in:
2025-11-14 02:35:17 +01:00
parent 6f4ff68062
commit a3c5494bf7
53 changed files with 269 additions and 340 deletions
@@ -153,19 +153,10 @@ const useDocumentsWorkspace = ({
} = appState;
const tenantRecord = (tenant ?? null) as TenantOption | null;
const tenantName: string | null = typeof tenantRecord?.name === 'string'
? tenantRecord.name
: typeof tenantRecord?.slug === 'string'
? tenantRecord.slug
: null;
const tenantNameCandidate = tenantRecord?.name ?? tenantRecord?.slug ?? null;
const tenantName = tenantNameCandidate ? String(tenantNameCandidate) : null;
const currentTenantId: Identifier | null = (() => {
const value = tenantRecord?.id;
if (typeof value === 'string' || typeof value === 'number') {
return value as Identifier;
}
return null;
})();
const currentTenantId: Identifier | null = (tenantRecord?.id ?? null) as Identifier | null;
const tenantOptions: TenantOption[] = Array.isArray(tenantOptionsRaw)
? (tenantOptionsRaw as TenantOption[])
@@ -306,11 +297,9 @@ const useDocumentsWorkspace = ({
folderContentsRef.current = folderContents;
}, [folderContents]);
const setSearchResultsRef = useRef(() => {});
const setSearchResultsRef = useRef<(value: unknown) => void>(() => {});
const setSearchResultsProxy = useCallback((value) => {
if (typeof setSearchResultsRef.current === 'function') {
setSearchResultsRef.current(value);
}
setSearchResultsRef.current(value);
}, []);
const {
@@ -1290,7 +1279,9 @@ const useDocumentsWorkspace = ({
if (docOrId == null) {
return;
}
const docId = typeof docOrId === 'object' ? docOrId?.id : docOrId;
const docId: Identifier | null = Object(docOrId) === docOrId
? (docOrId as DocumentLike)?.id ?? null
: (docOrId as Identifier | null);
if (docId == null) {
return;
}