From 803b35de9776d2ca040d767d85f25dd73b3d8272 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 22 Oct 2024 14:57:35 +0800 Subject: [PATCH 01/10] chore: some ui updates --- .../components/blocks/base/base-detail.svelte | 22 +++++++++++-------- .../dashboards/[dashboardId]/+layout.ts | 2 +- .../dashboards/[dashboardId]/+page.svelte | 4 ++-- .../(authed)/(space)/t/[tableId]/+layout.ts | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/base/base-detail.svelte b/apps/frontend/src/lib/components/blocks/base/base-detail.svelte index c7cf8ee4e..f83d8a6a5 100644 --- a/apps/frontend/src/lib/components/blocks/base/base-detail.svelte +++ b/apps/frontend/src/lib/components/blocks/base/base-detail.svelte @@ -39,25 +39,25 @@ {#if $hasPermission("table:create")} @@ -65,9 +65,13 @@ {#if $hasPermission("dashboard:create")} @@ -76,14 +80,14 @@
{#if base.dashboards.length > 0} -

Dashboards

+

Dashboards

{#each base.dashboards as dashboard} {#if dashboard} @@ -98,7 +102,7 @@
{/if} -

Tables

+

Tables

diff --git a/apps/frontend/src/routes/(authed)/(space)/dashboards/[dashboardId]/+layout.ts b/apps/frontend/src/routes/(authed)/(space)/dashboards/[dashboardId]/+layout.ts index 7c1d7efb2..50945c116 100644 --- a/apps/frontend/src/routes/(authed)/(space)/dashboards/[dashboardId]/+layout.ts +++ b/apps/frontend/src/routes/(authed)/(space)/dashboards/[dashboardId]/+layout.ts @@ -7,7 +7,7 @@ export const prerender = "auto" export const load: LayoutLoad = async (event) => { const { dashboardId } = event.params - event.depends(`dashboard:${dashboardId}`) + event.depends(`undb:dashboard:${dashboardId}`) const store = new GetDashboardQueryStore() diff --git a/apps/frontend/src/routes/(authed)/(space)/dashboards/[dashboardId]/+page.svelte b/apps/frontend/src/routes/(authed)/(space)/dashboards/[dashboardId]/+page.svelte index c4a0a4e9d..c048eb76c 100644 --- a/apps/frontend/src/routes/(authed)/(space)/dashboards/[dashboardId]/+page.svelte +++ b/apps/frontend/src/routes/(authed)/(space)/dashboards/[dashboardId]/+page.svelte @@ -132,8 +132,8 @@ { - invalidate(`undb:dashboard:${$dashboard.id.value}`) + onSuccess={async () => { + await invalidate(`undb:dashboard:${$dashboard.id.value}`) }} /> diff --git a/apps/frontend/src/routes/(authed)/(space)/t/[tableId]/+layout.ts b/apps/frontend/src/routes/(authed)/(space)/t/[tableId]/+layout.ts index d4f5eab89..03a74842d 100644 --- a/apps/frontend/src/routes/(authed)/(space)/t/[tableId]/+layout.ts +++ b/apps/frontend/src/routes/(authed)/(space)/t/[tableId]/+layout.ts @@ -7,7 +7,7 @@ export const prerender = "auto" export const load: LayoutLoad = async (event) => { const { tableId } = event.params - event.depends(`table:${tableId}`) + event.depends(`undb:table:${tableId}`) const store = new GetTableQueryStore() From 9af652eab1f63f84f21a67ffa711ea30104a5fc3 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Wed, 23 Oct 2024 12:25:12 +0800 Subject: [PATCH 02/10] chore: try to add cdn --- Dockerfile | 3 +++ apps/frontend/svelte.config.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 340e78f45..f35d25f82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM node:22 as builder +ARG CDN_URL +ENV PUBLIC_CDN_URL=$CDN_URL + WORKDIR /usr/src/app RUN npm i -g bun diff --git a/apps/frontend/svelte.config.js b/apps/frontend/svelte.config.js index d236ed9ea..1a379510c 100644 --- a/apps/frontend/svelte.config.js +++ b/apps/frontend/svelte.config.js @@ -12,6 +12,9 @@ const config = { pages: "dist", fallback: "index.html", }), + paths: { + assets: import.meta.env.PUBLIC_CDN_URL || "", + }, env: { publicPrefix: "UNDB_PUBLIC_", }, From 5e7974b7af9742df8bca755649b55a7ad0569751 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Wed, 23 Oct 2024 12:42:24 +0800 Subject: [PATCH 03/10] chore: try to add cdn --- apps/frontend/svelte.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/frontend/svelte.config.js b/apps/frontend/svelte.config.js index 1a379510c..26cf22c0b 100644 --- a/apps/frontend/svelte.config.js +++ b/apps/frontend/svelte.config.js @@ -13,7 +13,7 @@ const config = { fallback: "index.html", }), paths: { - assets: import.meta.env.PUBLIC_CDN_URL || "", + assets: process.env.env.PUBLIC_CDN_URL || "", }, env: { publicPrefix: "UNDB_PUBLIC_", From ac11194fc5a206f906a4a7ba86d4ec2f551db14f Mon Sep 17 00:00:00 2001 From: nichenqin Date: Wed, 23 Oct 2024 12:51:23 +0800 Subject: [PATCH 04/10] chore: try to add cdn --- apps/frontend/svelte.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/frontend/svelte.config.js b/apps/frontend/svelte.config.js index 26cf22c0b..ebe200df0 100644 --- a/apps/frontend/svelte.config.js +++ b/apps/frontend/svelte.config.js @@ -13,7 +13,7 @@ const config = { fallback: "index.html", }), paths: { - assets: process.env.env.PUBLIC_CDN_URL || "", + assets: process.env.PUBLIC_CDN_URL || "", }, env: { publicPrefix: "UNDB_PUBLIC_", From 24de5e22cb240ec83b3c885bc6deaca8a49570d3 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Wed, 23 Oct 2024 13:18:49 +0800 Subject: [PATCH 05/10] chore: try to add cdn --- apps/backend/src/modules/web/web.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/backend/src/modules/web/web.tsx b/apps/backend/src/modules/web/web.tsx index 73cc2386e..2ad1e3e80 100644 --- a/apps/backend/src/modules/web/web.tsx +++ b/apps/backend/src/modules/web/web.tsx @@ -6,7 +6,16 @@ import Elysia from "elysia" @singleton() export class Web { route() { - const index = Bun.file("dist/index.html") + const cdnUrl = process.env.PUBLIC_CDN_URL + const getAsset = (path: string) => { + if (cdnUrl) { + return `${cdnUrl}${path}` + } + return Bun.file(`dist${path}`) + } + + const index = getAsset("/index.html") + return new Elysia() .use(staticPlugin({ prefix: "/", assets: "dist" })) .use(staticPlugin({ prefix: "/assets", assets: "assets" })) From e31fbe638ca61188d942ecfbd69062cfe91abe73 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Wed, 23 Oct 2024 15:36:14 +0800 Subject: [PATCH 06/10] chore: try to add cdn --- apps/backend/src/modules/web/web.tsx | 37 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/apps/backend/src/modules/web/web.tsx b/apps/backend/src/modules/web/web.tsx index 2ad1e3e80..362255293 100644 --- a/apps/backend/src/modules/web/web.tsx +++ b/apps/backend/src/modules/web/web.tsx @@ -7,36 +7,37 @@ import Elysia from "elysia" export class Web { route() { const cdnUrl = process.env.PUBLIC_CDN_URL - const getAsset = (path: string) => { + const getAsset = async (path: string) => { if (cdnUrl) { - return `${cdnUrl}${path}` + const response = await fetch(`${cdnUrl}${path}`) + return response.text() } - return Bun.file(`dist${path}`) + return Bun.file(`dist${path}`).text() } - const index = getAsset("/index.html") + const getIndex = () => getAsset("/index.html") return new Elysia() .use(staticPlugin({ prefix: "/", assets: "dist" })) .use(staticPlugin({ prefix: "/assets", assets: "assets" })) - .get("/", () => index) - .get("/t/*", () => index) - .get("/dashboards/*", () => index) - .get("/s/*", () => index) - .get("/bases/*", () => index) - .get("/account/*", () => index) - .get("/settings", () => index) - .get("/login", () => index) - .get("/signup", (ctx) => { + .get("/", () => getIndex()) + .get("/t/*", () => getIndex()) + .get("/dashboards/*", () => getIndex()) + .get("/s/*", () => getIndex()) + .get("/bases/*", () => getIndex()) + .get("/account/*", () => getIndex()) + .get("/settings", () => getIndex()) + .get("/login", () => getIndex()) + .get("/signup", async (ctx) => { if (env.UNDB_DISABLE_REGISTRATION) { ctx.redirect("/login", 302) return } - return index + return getIndex() }) - .get("/verify-email", () => index) - .get("/reset-password/*", () => index) - .get("/create-from-share/*", () => index) - .get("/templates/*", () => index) + .get("/verify-email", () => getIndex()) + .get("/reset-password/*", () => getIndex()) + .get("/create-from-share/*", () => getIndex()) + .get("/templates/*", () => getIndex()) } } From 3832fc1304c07b2db2112625a1c3c7731f225bdc Mon Sep 17 00:00:00 2001 From: nichenqin Date: Thu, 24 Oct 2024 13:00:30 +0800 Subject: [PATCH 07/10] feat: allow to show gallery without an attachment field --- .../aggregate/config/aggregate-config.svelte | 2 +- .../blocks/create-field/create-field.svelte | 2 +- .../components/blocks/field/field-menu.svelte | 4 +- .../blocks/forms/create-form.svelte | 2 +- .../blocks/forms/form-display.svelte | 2 +- .../blocks/forms/form-fields-editor.svelte | 2 +- .../blocks/forms/form-option.svelte | 6 +-- .../gallery-view/gallery-option-button.svelte | 29 +++++++++++ .../gallery-view/gallery-view-card.svelte | 49 +++++++++++-------- .../gallery-view/gallery-view-cards.svelte | 2 +- .../gallery-view-field-form.svelte | 25 ++++++++-- .../blocks/gallery-view/gallery-view.svelte | 17 ++++--- .../blocks/grid-view/grid-view-footer.svelte | 2 +- .../blocks/import-table/import-table.svelte | 2 +- .../blocks/kanban-view/kanban-view.svelte | 6 +-- .../select-kanban-field-form.svelte | 15 +++++- .../kanban-view/select-kanban-lane.svelte | 2 +- .../kanban-view/select-kanban-view.svelte | 2 +- .../blocks/list-view/list-view.svelte | 4 +- .../blocks/share/share-button.svelte | 4 +- .../blocks/update-field/update-field.svelte | 2 +- .../blocks/update-table/update-table.svelte | 2 +- .../view-color-editor.svelte | 2 +- .../blocks/view-fields/view-fields.svelte | 4 +- .../view-filter-editor.svelte | 2 +- .../blocks/view-sort/view-sort.svelte | 2 +- .../blocks/view/create-view-button.svelte | 2 +- .../blocks/view/delete-view-dialog.svelte | 4 +- .../blocks/view/duplicate-view.svelte | 2 +- .../widget/create-view-widget-form.svelte | 2 +- .../components/blocks/widget/widget.svelte | 4 +- 31 files changed, 136 insertions(+), 71 deletions(-) create mode 100644 apps/frontend/src/lib/components/blocks/gallery-view/gallery-option-button.svelte diff --git a/apps/frontend/src/lib/components/blocks/aggregate/config/aggregate-config.svelte b/apps/frontend/src/lib/components/blocks/aggregate/config/aggregate-config.svelte index aa50ff5b1..6183daf17 100644 --- a/apps/frontend/src/lib/components/blocks/aggregate/config/aggregate-config.svelte +++ b/apps/frontend/src/lib/components/blocks/aggregate/config/aggregate-config.svelte @@ -47,7 +47,7 @@ mutationFn: trpc.table.view.widget.update.mutate, async onSuccess(data, variables, context) { if (table) { - await invalidate(`table:${table.id.value}`) + await invalidate(`undb:table:${table.id.value}`) await tick() await client.invalidateQueries({ queryKey: ["aggregate", table.id.value, widget.id] }) } diff --git a/apps/frontend/src/lib/components/blocks/create-field/create-field.svelte b/apps/frontend/src/lib/components/blocks/create-field/create-field.svelte index c7c478daa..df01ce3cb 100644 --- a/apps/frontend/src/lib/components/blocks/create-field/create-field.svelte +++ b/apps/frontend/src/lib/components/blocks/create-field/create-field.svelte @@ -31,7 +31,7 @@ async onSuccess() { toast.success("Create field success") reset() - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await client.invalidateQueries({ queryKey: ["records", $table.id.value] }) onSuccess() }, diff --git a/apps/frontend/src/lib/components/blocks/field/field-menu.svelte b/apps/frontend/src/lib/components/blocks/field/field-menu.svelte index 132c48f39..1c1569b5d 100644 --- a/apps/frontend/src/lib/components/blocks/field/field-menu.svelte +++ b/apps/frontend/src/lib/components/blocks/field/field-menu.svelte @@ -56,7 +56,7 @@ mutationFn: trpc.table.field.delete.mutate, async onSuccess() { toast.success("Delete field success") - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await client.invalidateQueries({ queryKey: ["records", $table.id.value] }) open = false deleteAlertOpen = false @@ -70,7 +70,7 @@ mutationFn: trpc.table.field.duplicate.mutate, async onSuccess() { toast.success("Duplicate field success") - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await client.invalidateQueries({ queryKey: ["records", $table.id.value] }) open = false }, diff --git a/apps/frontend/src/lib/components/blocks/forms/create-form.svelte b/apps/frontend/src/lib/components/blocks/forms/create-form.svelte index 6496c1abd..910d15991 100644 --- a/apps/frontend/src/lib/components/blocks/forms/create-form.svelte +++ b/apps/frontend/src/lib/components/blocks/forms/create-form.svelte @@ -22,7 +22,7 @@ mutationKey: ["table", $table.id.value, "createForm"], async onSuccess(data) { toast.success("create form successfully") - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) formId.set(data.formId) onSuccess?.() }, diff --git a/apps/frontend/src/lib/components/blocks/forms/form-display.svelte b/apps/frontend/src/lib/components/blocks/forms/form-display.svelte index 7ddd1d5dc..d2100a369 100644 --- a/apps/frontend/src/lib/components/blocks/forms/form-display.svelte +++ b/apps/frontend/src/lib/components/blocks/forms/form-display.svelte @@ -37,7 +37,7 @@ mutationKey: ["table", $table.id.value, "setForm"], mutationFn: trpc.table.form.set.mutate, async onSuccess() { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) }, }) diff --git a/apps/frontend/src/lib/components/blocks/forms/form-fields-editor.svelte b/apps/frontend/src/lib/components/blocks/forms/form-fields-editor.svelte index bb3a70855..f101da73a 100644 --- a/apps/frontend/src/lib/components/blocks/forms/form-fields-editor.svelte +++ b/apps/frontend/src/lib/components/blocks/forms/form-fields-editor.svelte @@ -31,7 +31,7 @@ mutationKey: ["table", $table.id.value, "setForm"], mutationFn: trpc.table.form.set.mutate, async onSuccess() { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) }, }) diff --git a/apps/frontend/src/lib/components/blocks/forms/form-option.svelte b/apps/frontend/src/lib/components/blocks/forms/form-option.svelte index 77072a8c7..3c14bde60 100644 --- a/apps/frontend/src/lib/components/blocks/forms/form-option.svelte +++ b/apps/frontend/src/lib/components/blocks/forms/form-option.svelte @@ -39,7 +39,7 @@ mutationKey: ["table", $table.id.value, "setForm"], mutationFn: trpc.table.form.set.mutate, async onSuccess() { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) }, }) @@ -55,7 +55,7 @@ mutationKey: ["table", $table.id.value, "deleteForm"], mutationFn: trpc.table.form.delete.mutate, async onSuccess() { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await goto(`/t/${$table.id.value}`) }, }) @@ -76,7 +76,7 @@ async onSuccess(data) { toast.success("Duplicate form successfully") duplicateFormDialog = false - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) formId.set(data.formId) }, }) diff --git a/apps/frontend/src/lib/components/blocks/gallery-view/gallery-option-button.svelte b/apps/frontend/src/lib/components/blocks/gallery-view/gallery-option-button.svelte new file mode 100644 index 000000000..88281b16d --- /dev/null +++ b/apps/frontend/src/lib/components/blocks/gallery-view/gallery-option-button.svelte @@ -0,0 +1,29 @@ + + + + + + + + + {#if !readonly} + Update kanban view + {:else} + Kanban view + {/if} + + + + diff --git a/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view-card.svelte b/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view-card.svelte index af25e8fd0..b8840c984 100644 --- a/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view-card.svelte +++ b/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view-card.svelte @@ -24,10 +24,14 @@ let values = record.flatten() let displayValues = record.displayValues?.toJSON() ?? {} - export let fieldId: string + export let fieldId: string | undefined - let field = $table.schema.getFieldById(new FieldIdVo(fieldId)).into(undefined) as AttachmentField | undefined - $: fieldValues = record.getValue(new FieldIdVo(fieldId)).into(undefined) as AttachmentFieldValue | undefined + let field = (fieldId ? $table.schema.getFieldById(new FieldIdVo(fieldId)).into(undefined) : undefined) as + | AttachmentField + | undefined + $: fieldValues = (fieldId ? record.getValue(new FieldIdVo(fieldId)).into(undefined) : undefined) as + | AttachmentFieldValue + | undefined $: images = fieldValues?.getImages() ?? [] export let color: ViewColor | undefined @@ -36,23 +40,25 @@ $: condition = isMatch ? color?.getMatchedFieldConditions($table, record)[0] : undefined -
- {#if images.length > 0} - - - {#each images as image} - - - - {/each} - - - {:else} -
- -
+
+ {#if field} + {#if images.length > 0} + + + {#each images as image} + + + + {/each} + + + {:else} +
+ +
+ {/if} {/if} -
+
+ +
+ {/if}
diff --git a/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view.svelte b/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view.svelte index 49ecfad1b..d0c07190b 100644 --- a/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view.svelte +++ b/apps/frontend/src/lib/components/blocks/gallery-view/gallery-view.svelte @@ -12,6 +12,7 @@ import ViewPagination from "../view/view-pagination.svelte" import { cn } from "$lib/utils" import GalleryViewLoading from "./gallery-view-loading.svelte" + import GalleryViewOptionButton from "./gallery-option-button.svelte" const table = getTable() export let viewId: Readable @@ -75,12 +76,14 @@ $: total = ($getRecordsQuery.data as any)?.total - -
- {#if !field} - - {:else if $isLoading} - + + {#if !shareId} + + {/if} + +
+ {#if $isLoading} + {:else} {/if} @@ -94,7 +97,7 @@ {/await} {#await import("$lib/components/blocks/record-detail/table-record-detail-sheet.svelte") then { default: TableRecordDetailSheet }} - + {/await} {#await import("$lib/components/blocks/view-widget/view-widget-sheet.svelte") then { default: ViewWidgetSheet }} diff --git a/apps/frontend/src/lib/components/blocks/grid-view/grid-view-footer.svelte b/apps/frontend/src/lib/components/blocks/grid-view/grid-view-footer.svelte index 9df49a0b9..bd4128be0 100644 --- a/apps/frontend/src/lib/components/blocks/grid-view/grid-view-footer.svelte +++ b/apps/frontend/src/lib/components/blocks/grid-view/grid-view-footer.svelte @@ -37,7 +37,7 @@ mutationKey: ["table", $table.id.value, "setViewAggregate"], mutationFn: trpc.table.view.setAggregate.mutate, async onSuccess() { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await client.invalidateQueries({ queryKey: ["aggregates", $table.id.value] }) }, })), diff --git a/apps/frontend/src/lib/components/blocks/import-table/import-table.svelte b/apps/frontend/src/lib/components/blocks/import-table/import-table.svelte index 579baac72..ecd127931 100644 --- a/apps/frontend/src/lib/components/blocks/import-table/import-table.svelte +++ b/apps/frontend/src/lib/components/blocks/import-table/import-table.svelte @@ -55,7 +55,7 @@ async onSuccess() { await invalidate("undb:tables") await goto(`/t/${tableId}`) - await invalidate(`table:${tableId}`) + await invalidate(`undb:table:${tableId}`) closeModal(IMPORT_TABLE_MODAL) baseId.set(null) }, diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/kanban-view.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/kanban-view.svelte index dee12c3c8..8d0bcd0d8 100644 --- a/apps/frontend/src/lib/components/blocks/kanban-view/kanban-view.svelte +++ b/apps/frontend/src/lib/components/blocks/kanban-view/kanban-view.svelte @@ -30,7 +30,7 @@ {#key $table.id.value} - + {#if !shareId} {/if} @@ -56,10 +56,10 @@ {/await} {#await import("$lib/components/blocks/record-detail/table-record-detail-sheet.svelte") then { default: TableRecordDetailSheet }} - + {/await} {#await import("$lib/components/blocks/view-widget/view-widget-sheet.svelte") then { default: ViewWidgetSheet }} - + {/await} {/key} diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-field-form.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-field-form.svelte index 147569f5f..1ae054014 100644 --- a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-field-form.svelte +++ b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-field-form.svelte @@ -11,6 +11,7 @@ import { toast } from "svelte-sonner" import { invalidate } from "$app/navigation" import { hasPermission } from "$lib/store/space-member.store" + import { CircleCheckBigIcon } from "lucide-svelte" export let readonly = false @@ -52,7 +53,7 @@ mutationKey: ["updateView"], async onSuccess(data, variables, context) { toast.success("View updated") - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) }, }) @@ -84,7 +85,17 @@ {#if !readonly}
- +
{/if}
diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte index 92d15fcf8..caee90faf 100644 --- a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte +++ b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte @@ -134,7 +134,7 @@ onSuccess: async (data, variables, context) => { toast.success("Option updated") updateOptionDialogOpen = false - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) }, onError: (error, variables, context) => { toast.error(error.message) diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-view.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-view.svelte index 7661f9ba9..bd4877ebb 100644 --- a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-view.svelte +++ b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-view.svelte @@ -43,7 +43,7 @@ mutationFn: trpc.table.field.update.mutate, mutationKey: ["table", $table.id.value, "field", fieldId, "update"], async onSuccess(data) { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) }, onError(e) { toast.error(e.message) diff --git a/apps/frontend/src/lib/components/blocks/list-view/list-view.svelte b/apps/frontend/src/lib/components/blocks/list-view/list-view.svelte index 4882f5767..cf6682ffa 100644 --- a/apps/frontend/src/lib/components/blocks/list-view/list-view.svelte +++ b/apps/frontend/src/lib/components/blocks/list-view/list-view.svelte @@ -75,7 +75,7 @@
{#if $isLoading}
- +
{:else} @@ -88,7 +88,7 @@ {/await} {#await import("$lib/components/blocks/record-detail/table-record-detail-sheet.svelte") then { default: TableRecordDetailSheet }} - + {/await} {#await import("$lib/components/blocks/view-widget/view-widget-sheet.svelte") then { default: ViewWidgetSheet }} diff --git a/apps/frontend/src/lib/components/blocks/share/share-button.svelte b/apps/frontend/src/lib/components/blocks/share/share-button.svelte index c48c10332..8a6cae49d 100644 --- a/apps/frontend/src/lib/components/blocks/share/share-button.svelte +++ b/apps/frontend/src/lib/components/blocks/share/share-button.svelte @@ -31,7 +31,7 @@ mutationFn: trpc.share.enable.mutate, async onSuccess(data, variables, context) { if ($t) { - await invalidate(`table:${$t.id.value}`) + await invalidate(`undb:table:${$t.id.value}`) } onSuccess() }, @@ -54,7 +54,7 @@ mutationFn: trpc.share.disable.mutate, async onSuccess(data, variables, context) { if ($t) { - await invalidate(`table:${$t.id.value}`) + await invalidate(`undb:table:${$t.id.value}`) } onSuccess() }, diff --git a/apps/frontend/src/lib/components/blocks/update-field/update-field.svelte b/apps/frontend/src/lib/components/blocks/update-field/update-field.svelte index 5f6c53ee9..b4ece9396 100644 --- a/apps/frontend/src/lib/components/blocks/update-field/update-field.svelte +++ b/apps/frontend/src/lib/components/blocks/update-field/update-field.svelte @@ -33,7 +33,7 @@ async onSuccess() { onSuccess() toast.success("Update field success") - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await client.invalidateQueries({ queryKey: ["records", $table.id.value] }) reset() }, diff --git a/apps/frontend/src/lib/components/blocks/update-table/update-table.svelte b/apps/frontend/src/lib/components/blocks/update-table/update-table.svelte index 17d1a4ae9..5478d5531 100644 --- a/apps/frontend/src/lib/components/blocks/update-table/update-table.svelte +++ b/apps/frontend/src/lib/components/blocks/update-table/update-table.svelte @@ -19,7 +19,7 @@ mutationFn: trpc.table.update.mutate, async onSuccess(data, variables, context) { toast.success("Table updated") - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) toggleModal(UPDATE_TABLE_MODAL) }, onError(error, variables, context) { diff --git a/apps/frontend/src/lib/components/blocks/view-color-editor/view-color-editor.svelte b/apps/frontend/src/lib/components/blocks/view-color-editor/view-color-editor.svelte index 92d2e8a45..bf64b35b7 100644 --- a/apps/frontend/src/lib/components/blocks/view-color-editor/view-color-editor.svelte +++ b/apps/frontend/src/lib/components/blocks/view-color-editor/view-color-editor.svelte @@ -38,7 +38,7 @@ mutationKey: ["table", $table.id.value, "setColor"], mutationFn: trpc.table.view.setColor.mutate, onSuccess: async () => { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) open = false }, }) diff --git a/apps/frontend/src/lib/components/blocks/view-fields/view-fields.svelte b/apps/frontend/src/lib/components/blocks/view-fields/view-fields.svelte index 81bdc0fa7..9d16610be 100644 --- a/apps/frontend/src/lib/components/blocks/view-fields/view-fields.svelte +++ b/apps/frontend/src/lib/components/blocks/view-fields/view-fields.svelte @@ -45,7 +45,7 @@ mutationFn: trpc.table.view.setFields.mutate, mutationKey: ["table", $table.id.value, "setFields"], async onSuccess(data, variables, context) { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await client.invalidateQueries({ queryKey: ["records", $table.id.value] }) }, }) @@ -77,7 +77,7 @@ mutationFn: trpc.table.view.setOption.mutate, mutationKey: ["table", $table.id.value, "setOption"], async onSuccess(data, variables, context) { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) client.invalidateQueries({ queryKey: ["records", $table.id.value] }) }, }) diff --git a/apps/frontend/src/lib/components/blocks/view-filter-editor/view-filter-editor.svelte b/apps/frontend/src/lib/components/blocks/view-filter-editor/view-filter-editor.svelte index 7a4b82cd4..290c205cb 100644 --- a/apps/frontend/src/lib/components/blocks/view-filter-editor/view-filter-editor.svelte +++ b/apps/frontend/src/lib/components/blocks/view-filter-editor/view-filter-editor.svelte @@ -42,7 +42,7 @@ mutationKey: ["table", $table.id.value, "setFilters"], mutationFn: trpc.table.view.setFilter.mutate, onSuccess: async () => { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await client.invalidateQueries({ queryKey: ["records", $table.id.value] }) await client.invalidateQueries({ queryKey: ["aggregates", $table.id.value] }) open = false diff --git a/apps/frontend/src/lib/components/blocks/view-sort/view-sort.svelte b/apps/frontend/src/lib/components/blocks/view-sort/view-sort.svelte index 94b5839b2..d9d41ed82 100644 --- a/apps/frontend/src/lib/components/blocks/view-sort/view-sort.svelte +++ b/apps/frontend/src/lib/components/blocks/view-sort/view-sort.svelte @@ -61,7 +61,7 @@ mutationKey: ["table", $table.id.value, "setSort"], mutationFn: trpc.table.view.setSort.mutate, async onSettled() { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await client.invalidateQueries({ queryKey: ["records", $table.id.value] }) open = false }, diff --git a/apps/frontend/src/lib/components/blocks/view/create-view-button.svelte b/apps/frontend/src/lib/components/blocks/view/create-view-button.svelte index ca8e2a6ee..50d0009b1 100644 --- a/apps/frontend/src/lib/components/blocks/view/create-view-button.svelte +++ b/apps/frontend/src/lib/components/blocks/view/create-view-button.svelte @@ -29,7 +29,7 @@ viewNames = [...viewNames, $formData.name] toast.success("created view successfully") reset() - await invalidate(`table:${tableId}`) + await invalidate(`undb:table:${tableId}`) await goto(`/t/${tableId}/${data.viewId}`) }, onError(e) { diff --git a/apps/frontend/src/lib/components/blocks/view/delete-view-dialog.svelte b/apps/frontend/src/lib/components/blocks/view/delete-view-dialog.svelte index 2b6a4ba4f..f98a1e6e5 100644 --- a/apps/frontend/src/lib/components/blocks/view/delete-view-dialog.svelte +++ b/apps/frontend/src/lib/components/blocks/view/delete-view-dialog.svelte @@ -3,7 +3,7 @@ import { DELETE_VIEW, isModalOpen, toggleModal } from "$lib/store/modal.store" import { trpc } from "$lib/trpc/client" import { createMutation } from "@tanstack/svelte-query" - import { getTable } from "$lib/store/table.store" + import { getTable } from "$lib/store/table.store" import { toast } from "svelte-sonner" import { goto, invalidate } from "$app/navigation" import { page } from "$app/stores" @@ -15,7 +15,7 @@ mutationKey: ["table", $viewId, "deleteView"], mutationFn: trpc.table.view.delete.mutate, async onSuccess(data, variables, context) { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) await goto(`/t/${$table.id.value}`) }, onError(error) { diff --git a/apps/frontend/src/lib/components/blocks/view/duplicate-view.svelte b/apps/frontend/src/lib/components/blocks/view/duplicate-view.svelte index 373033be9..20e063fdd 100644 --- a/apps/frontend/src/lib/components/blocks/view/duplicate-view.svelte +++ b/apps/frontend/src/lib/components/blocks/view/duplicate-view.svelte @@ -23,7 +23,7 @@ async onSuccess(data, variables, context) { closeModal(DUPLICATE_VIEW) toast.success("View duplicated") - await invalidate(`table:${data.tableId}`) + await invalidate(`undb:table:${data.tableId}`) await goto(`/t/${data.tableId}/${data.viewId}`) }, onError(error, variables, context) { diff --git a/apps/frontend/src/lib/components/blocks/widget/create-view-widget-form.svelte b/apps/frontend/src/lib/components/blocks/widget/create-view-widget-form.svelte index 31fb2e032..b5713cbd7 100644 --- a/apps/frontend/src/lib/components/blocks/widget/create-view-widget-form.svelte +++ b/apps/frontend/src/lib/components/blocks/widget/create-view-widget-form.svelte @@ -59,7 +59,7 @@ const createViewWidgetMutation = createMutation({ mutationFn: trpc.table.view.widget.create.mutate, async onSuccess(data) { - await invalidate(`table:${$table.id.value}`) + await invalidate(`undb:table:${$table.id.value}`) onSuccess() }, onError(error, variables, context) { diff --git a/apps/frontend/src/lib/components/blocks/widget/widget.svelte b/apps/frontend/src/lib/components/blocks/widget/widget.svelte index b72b93650..86d5c8c78 100644 --- a/apps/frontend/src/lib/components/blocks/widget/widget.svelte +++ b/apps/frontend/src/lib/components/blocks/widget/widget.svelte @@ -44,7 +44,7 @@ onSuccess: async () => { confirmDelete = false if (table) { - await invalidate(`table:${tableId}`) + await invalidate(`undb:table:${tableId}`) } }, onError(error, variables, context) { @@ -88,7 +88,7 @@ onSuccess: async () => { confirmDuplicate = false if (table) { - await invalidate(`table:${tableId}`) + await invalidate(`undb:table:${tableId}`) } }, onError(error, variables, context) { From 1d4f1689e8b76b602c725071cb4fd6cc70c53fe3 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Thu, 24 Oct 2024 13:11:05 +0800 Subject: [PATCH 08/10] fix: fix hidden fields --- .../blocks/field-control/reference-control.svelte | 4 ++-- .../blocks/record-detail/record-detail-sheet.svelte | 4 +++- .../components/blocks/record-detail/record-detail.svelte | 8 ++++---- .../blocks/record-detail/share-record-detail-sheet.svelte | 5 +++-- .../blocks/record-detail/table-record-detail-sheet.svelte | 2 +- .../components/blocks/template/template-preview.svelte | 2 +- .../s/b/[shareId]/t/[tableId]/[[viewId]]/+page.svelte | 2 +- .../src/routes/(share)/s/v/[shareId]/+page.svelte | 2 +- 8 files changed, 16 insertions(+), 13 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/field-control/reference-control.svelte b/apps/frontend/src/lib/components/blocks/field-control/reference-control.svelte index 813218c28..9312d7c47 100644 --- a/apps/frontend/src/lib/components/blocks/field-control/reference-control.svelte +++ b/apps/frontend/src/lib/components/blocks/field-control/reference-control.svelte @@ -15,7 +15,7 @@ let selected = writable(value) onMount(() => { - selected.set(value) + selected?.set(value) }) $: $selected, (value = $selected) @@ -39,7 +39,7 @@ > {#if hasValueReactive} {:else}