Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Fix query update for record-list

Hakan Shehuf69eb1dbaa8b
diff --git a/apps/desktop/src/main/queries/record-list.ts b/apps/desktop/src/main/queries/record-list.ts
index 399b954d..bd704084 100644
--- a/apps/desktop/src/main/queries/record-list.ts
+++ b/apps/desktop/src/main/queries/record-list.ts
@@ -66,27 +66,27 @@ export class RecordListQueryHandler
event.node.type === 'record' &&
event.node.attributes.databaseId === input.databaseId
) {
+ if (input.filters.length > 0 || input.sorts.length > 0) {
+ const newResult = await this.handleQuery(input);
+ return {
+ hasChanges: true,
+ result: newResult,
+ };
+ }
+
const record = output.find((record) => record.id === event.node.id);
if (record) {
- if (input.filters.length === 0 && input.sorts.length === 0) {
- const newResult = output.map((record) => {
- if (record.id === event.node.id) {
- return event.node as RecordNode;
- }
- return record;
- });
-
- return {
- hasChanges: true,
- result: newResult,
- };
- } else {
- const newResult = await this.handleQuery(input);
- return {
- hasChanges: true,
- result: newResult,
- };
- }
+ const newResult = output.map((record) => {
+ if (record.id === event.node.id) {
+ return event.node as RecordNode;
+ }
+ return record;
+ });
+
+ return {
+ hasChanges: true,
+ result: newResult,
+ };
}
}