Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 86d7651

Browse files
committed
self relation
1 parent a4804f5 commit 86d7651

File tree

5 files changed

+16
-23
lines changed

5 files changed

+16
-23
lines changed

src/components/cellTypes/Editor/RelationEditor.tsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,18 @@ const RelationEditor = (props: RelationEditorComponentProps) => {
4747

4848
useEffect(() => {
4949
setTimeout(async () => {
50-
async () => {
51-
const relationRows = await recordRowsFromRelation(
52-
tableColumn.config.related_note_path,
53-
DEFAULT_SETTINGS.local_settings,
54-
columnsInfo.getAllColumns()
55-
);
56-
const multiOptions = Object.entries(relationRows).map(
57-
([key, value]) => ({
58-
label: value,
59-
value: key,
60-
color: StyleVariables.BACKGROUND_SECONDARY,
61-
})
62-
);
50+
const relationRows = await recordRowsFromRelation(
51+
tableColumn.config.related_note_path,
52+
DEFAULT_SETTINGS.local_settings,
53+
columnsInfo.getAllColumns()
54+
);
55+
const multiOptions = Object.entries(relationRows).map(([key, value]) => ({
56+
label: value,
57+
value: key,
58+
color: StyleVariables.BACKGROUND_SECONDARY,
59+
}));
6360

64-
setRelationOptions(multiOptions);
65-
};
61+
setRelationOptions(multiOptions);
6662
}, 0);
6763
}, []);
6864

src/components/cellTypes/RelationCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const RelationCell = (mdProps: CellComponentProps) => {
5555
5
5656
);
5757
}
58-
}, [relationRow, dirtyCell]);
58+
}, [row, column, dirtyCell]);
5959

6060
const persistChange = (newPaths: string[]) => {
6161
const oldPaths = relationCell

src/components/cellTypes/RollupCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const RollupCell = (mdProps: CellComponentProps) => {
6767
);
6868
}
6969
}
70-
}, [row]);
70+
}, [cell, row, column]);
7171
return (
7272
<span
7373
ref={formulaRef}

src/components/modals/columnSettings/handlers/dropdowns/DatabaseSelectorHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class DatabaseSelectorHandler extends AbstractHandlerClass<ColumnSettings
1818
});
1919
columnSettingsManager.modal.enableReset = true;
2020
}
21-
const avaliableDDBB = recordAllDatabases(view.file.path);
21+
const avaliableDDBB = recordAllDatabases();
2222

2323
new Setting(containerEl)
2424
.setName(this.settingTitle)

src/helpers/RelationHelper.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ import { TableColumn } from "cdm/FolderModel";
1212
* @param currentPath
1313
* @returns
1414
*/
15-
export function recordAllDatabases(currentPath?: string): Record<string, string> {
15+
export function recordAllDatabases(): Record<string, string> {
1616
const avaliableDDBB: Record<string, string> = {};
1717
DataviewService.getDataviewAPI().pages().where((page) => {
18-
const file = (page as SMarkdownPage).file;
19-
const optionalFilter = currentPath ? file.path !== currentPath : true;
20-
// Check if is a ddbb and is not the current one
21-
return page[DatabaseCore.FRONTMATTER_KEY] !== undefined && optionalFilter;
18+
return page[DatabaseCore.FRONTMATTER_KEY] !== undefined;
2219
}).forEach((page) => {
2320
const file = (page as SMarkdownPage).file;
2421
avaliableDDBB[file.path] = file.name;

0 commit comments

Comments
 (0)