Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Fix some mutations
Hakan Shehudb4614c48ef4
diff --git a/desktop/src/main/handlers/mutations/board-view-create.ts b/desktop/src/main/handlers/mutations/board-view-create.tsindex 179d850f..0fc25b64 100644--- a/desktop/src/main/handlers/mutations/board-view-create.ts+++ b/desktop/src/main/handlers/mutations/board-view-create.ts@@ -45,6 +45,8 @@ export class BoardViewCreateMutationHandlertype: NodeTypes.BoardView,parentId: input.databaseId,index: generateNodeIndex(maxIndex, null),+ name: input.name,+ groupBy: input.groupBy,},},input.userId,diff --git a/desktop/src/main/handlers/mutations/calendar-view-create.ts b/desktop/src/main/handlers/mutations/calendar-view-create.tsindex b87300b9..7bffb35e 100644--- a/desktop/src/main/handlers/mutations/calendar-view-create.ts+++ b/desktop/src/main/handlers/mutations/calendar-view-create.ts@@ -45,6 +45,8 @@ export class CalendarViewCreateMutationHandlertype: NodeTypes.CalendarView,parentId: input.databaseId,index: generateNodeIndex(maxIndex, null),+ name: input.name,+ groupBy: input.groupBy,},},input.userId,diff --git a/desktop/src/main/handlers/mutations/channel-create.ts b/desktop/src/main/handlers/mutations/channel-create.tsindex 3c1a441b..f0031f06 100644--- a/desktop/src/main/handlers/mutations/channel-create.ts+++ b/desktop/src/main/handlers/mutations/channel-create.ts@@ -40,6 +40,7 @@ export class ChannelCreateMutationHandlertype: NodeTypes.Channel,parentId: input.spaceId,index: generateNodeIndex(maxIndex, null),+ name: input.name,},},input.userId,diff --git a/desktop/src/main/handlers/mutations/node-sync.ts b/desktop/src/main/handlers/mutations/node-sync.tsindex f1cc914f..44c06c8e 100644--- a/desktop/src/main/handlers/mutations/node-sync.ts+++ b/desktop/src/main/handlers/mutations/node-sync.ts@@ -37,6 +37,15 @@ export class NodeSyncMutationHandlerconst workspaceDatabase =await databaseManager.getWorkspaceDatabase(userId);+ if (node.deletedAt) {+ await workspaceDatabase+ .deleteFrom('nodes')+ .where('id', '=', node.id)+ .execute();++ continue;+ }+const existingNode = await workspaceDatabase.selectFrom('nodes').where('id', '=', node.id)diff --git a/desktop/src/main/handlers/mutations/table-view-create.ts b/desktop/src/main/handlers/mutations/table-view-create.tsindex c978a5a1..6d32b0ac 100644--- a/desktop/src/main/handlers/mutations/table-view-create.ts+++ b/desktop/src/main/handlers/mutations/table-view-create.ts@@ -45,6 +45,7 @@ export class TableViewCreateMutationHandlertype: NodeTypes.TableView,parentId: input.databaseId,index: generateNodeIndex(maxIndex, null),+ name: input.name,},},input.userId,diff --git a/desktop/src/main/handlers/queries/database-view-list.ts b/desktop/src/main/handlers/queries/database-view-list.tsindex 3b0b99fc..fad06a64 100644--- a/desktop/src/main/handlers/queries/database-view-list.ts+++ b/desktop/src/main/handlers/queries/database-view-list.ts@@ -17,6 +17,7 @@ import {} from '@/types/databases';import { isEqual } from 'lodash';import { MutationChange } from '@/operations/mutations';+import { compareString } from '@/lib/utils';export class DatabaseViewListQueryHandlerimplements QueryHandler<DatabaseViewListQueryInput>@@ -90,7 +91,9 @@ export class DatabaseViewListQueryHandler}private buildViewNodes = (rows: SelectNode[]): ViewNode[] => {- const nodes = rows.map((row) => mapNode(row));+ const nodes = rows+ .sort((a, b) => compareString(a.index, b.index))+ .map((row) => mapNode(row));const views: ViewNode[] = [];for (const node of nodes) {const view = this.buildViewNode(node);diff --git a/desktop/src/renderer/components/avatars/avatar.tsx b/desktop/src/renderer/components/avatars/avatar.tsxindex 457c1406..704dcd74 100644--- a/desktop/src/renderer/components/avatars/avatar.tsx+++ b/desktop/src/renderer/components/avatars/avatar.tsx@@ -74,7 +74,7 @@ const EmojiAvatar = ({ avatar, size, className }: AvatarProps) => {return (<imgsrc={url}- className={cn('rounded shadow', getAvatarSizeClasses(size), className)}+ className={cn(getAvatarSizeClasses(size), className)}alt={'Emoji'}/>);@@ -85,7 +85,7 @@ const IconAvatar = ({ avatar, size, className }: AvatarProps) => {return (<imgsrc={url}- className={cn('rounded shadow', getAvatarSizeClasses(size), className)}+ className={cn(getAvatarSizeClasses(size), className)}alt={'Icon'}/>);@@ -98,7 +98,7 @@ const CustomAvatar = ({ avatar, size, className }: AvatarProps) => {return (<imgsrc={url}- className={cn('rounded shadow', getAvatarSizeClasses(size), className)}+ className={cn(getAvatarSizeClasses(size), className)}alt={'Custom Avatar'}/>);diff --git a/desktop/src/renderer/components/databases/boards/board-view-card.tsx b/desktop/src/renderer/components/databases/boards/board-view-card.tsxindex ee448336..574c5cbf 100644--- a/desktop/src/renderer/components/databases/boards/board-view-card.tsx+++ b/desktop/src/renderer/components/databases/boards/board-view-card.tsx@@ -64,7 +64,7 @@ export const BoardViewCard = ({ record }: BoardViewCardProps) => {role="presentation"key={record.id}className={cn(- 'animate-fade-in flex cursor-pointer flex-col gap-1 rounded-md border p-2 hover:bg-gray-50',+ 'animate-fade-in flex cursor-pointer flex-col gap-1 rounded-md border p-2 text-left hover:bg-gray-50',hasName ? '' : 'text-muted-foreground',)}onClick={() => workspace.openModal(record.id)}