fix: Fix the bug where properties are null or undefined.

This commit is contained in:
liufree 2025-04-23 22:24:25 +08:00
parent f485bb2f86
commit d89744bbf2
2 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"name": "obsidian-querydash",
"version": "1.0.0",
"version": "1.0.1",
"description": "Refer to Dataview and add search, sorting, and pagination functions, just like Notion.",
"main": "main.js",
"scripts": {
@ -30,7 +30,7 @@
"obsidian": "latest",
"obsidian-dataview": "^0.5.67",
"tslib": "2.4.0",
"vite": "^6.2.0",
"vite": "^6.2.6",
"vite-plugin-css-injected-by-js": "^3.5.2"
}
}

View file

@ -30,7 +30,7 @@ const TableView: React.FC<ViewProps> = ({app, source}) => {
dataIndex: header,
sorter: (a, b) => a[header].display.toString().localeCompare(b[header].display.toString()),
render: (_, record) => {
const {type, path, display} = record[header];
const {type, path, display} = record[header]|| {};
if (type === "datetime") {
return display;
}
@ -67,7 +67,7 @@ const TableView: React.FC<ViewProps> = ({app, source}) => {
}
})
}
return display.toString();
return display?.toString();
}
};
});
@ -162,7 +162,7 @@ const TableView: React.FC<ViewProps> = ({app, source}) => {
pagination={{
showSizeChanger: true,
}}
headerTitle="TablieView"
headerTitle="TableView"
request={async (params, sort, filter) => {
// console.log('params:', params);
const response = await executeTableQuery(dv, source, params);