diff --git a/src/components/Inspector.tsx b/src/components/Inspector.tsx index 8f89a6d9..25901892 100644 --- a/src/components/Inspector.tsx +++ b/src/components/Inspector.tsx @@ -12,6 +12,7 @@ import { InstancesPanel, NoteInfoPanel, } from './InspectorPanels' +import type { ReferencedByItem } from './InspectorPanels' import { EmptyInspector, InitializePropertiesPrompt, InspectorHeader, InvalidFrontmatterNotice } from './inspector/InspectorChrome' import { useBacklinks, useReferencedBy } from './inspector/useInspectorData' import { useInspectorPropertyActions } from './inspector/useInspectorPropertyActions' @@ -64,7 +65,7 @@ function ValidFrontmatterPanels({ frontmatter: ReturnType typeEntryMap: Record vaultPath?: string - referencedBy: VaultEntry[] + referencedBy: ReferencedByItem[] onNavigate: (target: string) => void onCreateAndOpenNote?: (title: string) => Promise onUpdateProperty?: (key: string, value: FrontmatterValue) => void @@ -125,7 +126,7 @@ function PrimaryInspectorPanel({ entries: VaultEntry[] typeEntryMap: Record vaultPath?: string - referencedBy: VaultEntry[] + referencedBy: ReferencedByItem[] onNavigate: (target: string) => void onToggleRawEditor?: () => void onInitializeProperties?: (path: string) => void diff --git a/src/components/inspector/useInspectorPropertyActions.ts b/src/components/inspector/useInspectorPropertyActions.ts index db6e6156..db33434b 100644 --- a/src/components/inspector/useInspectorPropertyActions.ts +++ b/src/components/inspector/useInspectorPropertyActions.ts @@ -23,8 +23,9 @@ function bindMissingTypeAction( entry: VaultEntry | null, action: ((path: string, missingType: string, nextTypeName: string) => Promise) | undefined, ) { - if (!entry?.isA || !action) return undefined - return (nextTypeName: string) => action(entry.path, entry.isA, nextTypeName) + const missingType = entry?.isA + if (!entry || !missingType || !action) return undefined + return (nextTypeName: string) => action(entry.path, missingType, nextTypeName) } export function useInspectorPropertyActions({