refactor: introduce dedicated identifier types for improved clarity and type safety
This commit is contained in:
@@ -12,10 +12,10 @@ import SelectionAssignmentMenu, { SelectionAssignmentMenuItem } from './Selectio
|
||||
import SelectionSummary from './SelectionSummary';
|
||||
import { useAppState } from '../app/appState';
|
||||
import { useWorkspaceSelectionContext } from '../app/WorkspaceSelectionContext';
|
||||
import type { DocumentId } from '../types/identifiers';
|
||||
|
||||
const ROOT_FOLDER_LABEL = 'Documents';
|
||||
|
||||
type DocumentId = string | number;
|
||||
type NullableDocumentId = DocumentId | null;
|
||||
|
||||
type SelectedIdList = NullableDocumentId[] | null;
|
||||
@@ -145,7 +145,7 @@ const buildTagAssignments = (
|
||||
return [];
|
||||
}
|
||||
|
||||
const map = new Map<string | number, {
|
||||
const map = new Map<string, {
|
||||
id?: DocumentId;
|
||||
label: string;
|
||||
color: string | null;
|
||||
@@ -209,7 +209,7 @@ const buildCorrespondentAssignments = (
|
||||
return [];
|
||||
}
|
||||
|
||||
const map = new Map<string | number, {
|
||||
const map = new Map<string, {
|
||||
id?: DocumentId;
|
||||
label: string;
|
||||
count: number;
|
||||
@@ -491,7 +491,7 @@ const SelectionFloatingActions: React.FC<SelectionFloatingActionsProps> = ({
|
||||
const value = isRecord(candidate)
|
||||
? (candidate?.id ?? candidate?.value ?? null)
|
||||
: candidate;
|
||||
if (!value && value !== 0) {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
await onMoveDocumentsToFolder(documentIdList, value as DocumentId);
|
||||
|
||||
Reference in New Issue
Block a user