|
1 | 1 | <script lang="ts">
|
2 | 2 | import { page } from "$app/stores"
|
3 |
| - import GridViewDataTable from "$lib/components/blocks/grid-view/grid-view-data-table.svelte" |
4 | 3 | import { getTable } from "$lib/store/table.store"
|
5 |
| - import { trpc } from "$lib/trpc/client" |
6 |
| - import { createQuery } from "@tanstack/svelte-query" |
7 |
| - import { Records, type IRecordsDTO } from "@undb/table" |
8 | 4 | import { onMount, type ComponentType } from "svelte"
|
9 |
| - import { derived, writable } from "svelte/store" |
10 |
| - import { queryParam } from "sveltekit-search-params" |
| 5 | + import { derived } from "svelte/store" |
11 | 6 | import { isDataTab, isFormTab } from "$lib/store/tab.store"
|
12 | 7 | import ShareTableHeader from "$lib/components/blocks/table-header/share-table-header.svelte"
|
13 | 8 | import FormsReadonly from "$lib/components/blocks/forms/forms-readonly.svelte"
|
14 |
| - import { createRecordsStore, setRecordsStore } from "$lib/store/records.store" |
15 | 9 | import ShareGridView from "$lib/components/blocks/share/share-grid-view.svelte"
|
16 | 10 | import ShareGalleryView from "$lib/components/blocks/share/share-gallery-view.svelte"
|
17 | 11 | import ShareKanbanView from "$lib/components/blocks/share/share-kanban-view.svelte"
|
|
27 | 21 | const t = getTable()
|
28 | 22 |
|
29 | 23 | $: view = $t.views.getViewById($viewId)
|
30 |
| -
|
31 |
| - const perPage = writable(50) |
32 |
| - const currentPage = writable(1) |
33 |
| - const q = queryParam("q") |
34 |
| -
|
35 |
| - const getRecords = createQuery( |
36 |
| - derived([t, perPage, currentPage, viewId, page, q], ([$table, $perPage, $currentPage, $viewId, $page, $q]) => { |
37 |
| - return { |
38 |
| - queryKey: ["records", $table?.id.value, $viewId, $currentPage, $perPage, $q], |
39 |
| - queryFn: () => |
40 |
| - trpc.shareData.records.query({ |
41 |
| - shareId: $page.params.shareId, |
42 |
| - tableId: $table.id.value, |
43 |
| - viewId: $viewId, |
44 |
| - q: $q, |
45 |
| - }), |
46 |
| - } |
47 |
| - }), |
48 |
| - ) |
49 |
| -
|
50 |
| - $: records = (($getRecords.data as any)?.records as IRecordsDTO) ?? [] |
51 |
| -
|
52 |
| - const store = createRecordsStore() |
53 |
| - setRecordsStore(store) |
54 |
| - $: if ($getRecords.isSuccess) { |
55 |
| - store.setRecords(Records.fromJSON($t, records), $getRecords.dataUpdatedAt) |
56 |
| - } |
57 | 24 | </script>
|
58 | 25 |
|
59 | 26 | <ShareTableHeader />
|
|
0 commit comments