Skip to content

Commit 4195607

Browse files
committed
fix missing document icon in reusable components
1 parent 28f474c commit 4195607

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

apps/web/src/components/v2Editor/customBlocks/python/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ function PythonBlock(props: Props) {
316316
title,
317317
type: 'python',
318318
},
319-
props.document.title
319+
props.document.title,
320+
props.document.icon
320321
)
321322
} else if (!isComponentInstance) {
322323
// can only update component if it is not an instance

apps/web/src/components/v2Editor/customBlocks/sql/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ function SQLBlock(props: Props) {
445445
title,
446446
type: 'sql',
447447
},
448-
props.document.title
448+
props.document.title,
449+
props.document.icon
449450
)
450451
} else if (!isComponentInstance) {
451452
// can only update component if it is not an instance

apps/web/src/hooks/useReusableComponents.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ type API = {
2121
create: (
2222
workspaceId: string,
2323
data: Omit<NewReusableComponent, 'id'> & { id: string },
24-
documenTitle: string
24+
documenTitle: string,
25+
documentIcon: string
2526
) => void
2627
update: (
2728
workspaceId: string,
@@ -161,7 +162,8 @@ export function ReusableComponentsProvider(props: Props) {
161162
async (
162163
workspaceId: string,
163164
data: Omit<NewReusableComponent, 'id'> & { id: string },
164-
documentTitle: string
165+
documentTitle: string,
166+
documentIcon: string
165167
) => {
166168
// optimistic update
167169
setState((state) => {
@@ -176,6 +178,7 @@ export function ReusableComponentsProvider(props: Props) {
176178
document: {
177179
id: data.documentId,
178180
title: documentTitle,
181+
icon: documentIcon,
179182
},
180183
createdAt: new Date().toISOString(),
181184
updatedAt: new Date().toISOString(),

packages/database/src/components.ts

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export async function createReusableComponent(
7171
select: {
7272
id: true,
7373
title: true,
74+
icon: true,
7475
},
7576
},
7677
},
@@ -105,6 +106,7 @@ export async function updateReusableComponent(
105106
select: {
106107
id: true,
107108
title: true,
109+
icon: true,
108110
},
109111
},
110112
},

0 commit comments

Comments
 (0)