Skip to content

Commit 1d0faf1

Browse files
committed
fix: fix always refetch data
1 parent cb97465 commit 1d0faf1

File tree

8 files changed

+17
-8
lines changed

8 files changed

+17
-8
lines changed

apps/frontend/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type Audit {
1313
type Base {
1414
id: ID!
1515
name: String!
16+
option: JSON
1617
share: Share
1718
tables: [Table]!
1819
}

apps/frontend/src/lib/components/blocks/base/base-detail.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { CREATE_TABLE_MODAL, IMPORT_TABLE_MODAL, toggleModal } from "$lib/store/modal.store"
2+
import { CREATE_TABLE_MODAL, IMPORT_TABLE_MODAL, openModal, toggleModal } from "$lib/store/modal.store"
33
import { DatabaseIcon, ImportIcon, PlusCircleIcon, PlusIcon } from "lucide-svelte"
44
import * as Table from "$lib/components/ui/table"
55
import { goto } from "$app/navigation"
@@ -28,7 +28,7 @@
2828
class="flex h-32 w-80 flex-col justify-between rounded-lg border bg-gray-100 px-4 py-7 text-left transition-all hover:bg-gray-200/50 hover:shadow-lg"
2929
on:click={() => {
3030
baseId.set(base.id)
31-
toggleModal(CREATE_TABLE_MODAL)
31+
openModal(CREATE_TABLE_MODAL)
3232
}}
3333
>
3434
<PlusCircleIcon class="text-muted-foreground" />
@@ -40,7 +40,7 @@
4040
class="flex h-32 w-80 flex-col justify-between rounded-lg border bg-gray-100 px-4 py-7 text-left transition-all hover:bg-gray-200/50 hover:shadow-lg"
4141
on:click={() => {
4242
baseId.set(base.id)
43-
toggleModal(IMPORT_TABLE_MODAL)
43+
openModal(IMPORT_TABLE_MODAL)
4444
}}
4545
>
4646
<ImportIcon class="text-muted-foreground" />

apps/frontend/src/lib/store/base.store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { GetIndexQuery$result } from "$houdini"
33
import { derived, writable } from "svelte/store"
44
import { queryParam, ssp } from "sveltekit-search-params"
55

6-
export const baseId = queryParam("baseId", ssp.string())
6+
export const baseId = queryParam("baseId", ssp.string(), { pushHistory: false })
77

88
export const bases = writable<GetIndexQuery$result["bases"]>()
99

apps/frontend/src/lib/store/modal.store.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ export const isModalOpen = derived(modal, ($modal) => {
5050
return (type: ModalType) => $modal?.includes(type) ?? false
5151
})
5252

53+
export const openModal = (type: ModalType) => {
54+
modal.update(($modal) => {
55+
return $modal?.includes(type) ? $modal : [...($modal ?? []), type]
56+
})
57+
}
58+
5359
export const closeModal = (type: ModalType) => {
5460
modal.update(($modal) => {
5561
return $modal?.filter((m) => m !== type) ?? null

apps/frontend/src/routes/(authed)/(space)/bases/[baseId]/+layout.gql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ query GetBaseQuery($baseId: ID!) {
22
base(id: $baseId) {
33
id
44
name
5+
option
56

67
share {
78
enabled

apps/frontend/src/routes/(authed)/(space)/bases/[baseId]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
export let data: PageData
66
7-
$: getBaseStore = data.getBaseStore
7+
let getBaseStore = data.getBaseStore
88
$: base = $getBaseStore.data?.base
99
</script>
1010

apps/frontend/src/routes/(authed)/+layout.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import type { LayoutLoad } from "./$types"
44
export const ssr = false
55

66
export const load: LayoutLoad = async (event) => {
7-
const redirectURL = encodeURIComponent(event.url.pathname)
7+
// const redirectURL = encodeURIComponent(event.url.pathname)
88

9-
const search = new URLSearchParams({ redirect: redirectURL })
9+
// const search = new URLSearchParams({ redirect: redirectURL })
1010

11-
const me = await event.fetch("/api/me?" + search.toString())
11+
const me = await event.fetch("/api/me")
1212
if (me.redirected) {
1313
throw redirect(301, me.url)
1414
}

packages/graphql/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ export class Graphql {
258258
type Base {
259259
id: ID!
260260
name: String!
261+
option: JSON
261262
262263
share: Share
263264
tables: [Table]!

0 commit comments

Comments
 (0)