Skip to content

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

Fix query updates in record list query handler

Hakan Shehucad0da89b033
diff --git a/apps/desktop/src/main/queries/record-list.ts b/apps/desktop/src/main/queries/record-list.ts
index 8ae9fb54..399b954d 100644
--- a/apps/desktop/src/main/queries/record-list.ts
+++ b/apps/desktop/src/main/queries/record-list.ts
@@ -68,17 +68,25 @@ export class RecordListQueryHandler
) {
const record = output.find((record) => record.id === event.node.id);
if (record) {
- const newResult = output.map((record) => {
- if (record.id === event.node.id) {
- return event.node as RecordNode;
- }
- return record;
- });
-
- return {
- hasChanges: true,
- result: newResult,
- };
+ 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,
+ };
+ }
}
}