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

Commit 1cde474

Browse files
committed
Merge branch 'bug-reset-table-after-change-settings'
2 parents eff0e32 + c05ab1c commit 1cde474

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

docs/docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.3.1
2+
### No longer broken
3+
- dataview currently supports multiple key with same name and is considered as an array. Actually this kind of array generates an error in the database plugin. Now are controlled taking just the fist hit. It will be considered as an array with future versions.
4+
15
## 1.3.0
26
*Published on 2022/05/23*
37
### Shiny new things

src/components/reducers/DatabaseDispatch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function databaseReducer(state: TableDataType, action: ActionType) {
5454
columns: {
5555
[optionIndex]: {
5656
options: {
57-
$push: [newOption],
57+
$set: state.columns[optionIndex].options,
5858
},
5959
},
6060
},

src/services/DataviewService.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { getAPI, isPluginEnabled } from "obsidian-dataview";
55
import { Literal, WrappedLiteral } from "obsidian-dataview/lib/data-model/value";
66
import { DvAPIInterface } from "obsidian-dataview/lib/typings/api";
77
import { DateTime } from "luxon";
8+
import { LOGGER } from "services/Logger";
89
class DataviewProxy {
910

1011
private static instance: DataviewProxy;
@@ -62,10 +63,19 @@ class DataviewProxy {
6263

6364
parseLiteral(literal: Literal, dataTypeDst: string): Literal {
6465
let parsedLiteral: Literal = literal;
65-
const wrapped = this.getDataviewAPI().value.wrapValue(literal)
66-
if (wrapped.value === undefined || wrapped.value === null) {
66+
if (!this.getDataviewAPI().value.isTruthy(literal)) {
6767
return "";
6868
}
69+
70+
if ((literal as any).values !== undefined) {
71+
72+
literal = (literal as any).values[0];
73+
LOGGER.warn(`There is a repeated key into a file with this values: ${(literal as any).values[0]
74+
}`);
75+
}
76+
77+
const wrapped = this.getDataviewAPI().value.wrapValue(literal)
78+
6979
// Check empty or undefined literals
7080
switch (dataTypeDst) {
7181
case DataTypes.CALENDAR:
@@ -76,8 +86,9 @@ class DataviewProxy {
7686
parsedLiteral = wrapped.type === 'number' ? literal : Number(literal);
7787
break;
7888
default:
79-
// Values of dataview parse to md friendly strings
89+
8090
if (DateTime.isDateTime(wrapped.value)) {
91+
// Values of dataview parse to md friendly strings
8192
parsedLiteral = wrapped.value.toFormat("yyyy-MM-dd");
8293
} else {
8394
parsedLiteral = this.getDataviewAPI().value.toString(literal);

0 commit comments

Comments
 (0)