Skip to content

Commit

Permalink
Update url updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ezynda3 committed Mar 10, 2024
1 parent 42134d6 commit ade8be3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
10 changes: 3 additions & 7 deletions drizzle/meta/0001_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@
"indexes": {
"contracts_id_unique": {
"name": "contracts_id_unique",
"columns": [
"id"
],
"columns": ["id"],
"isUnique": true
}
},
Expand Down Expand Up @@ -115,9 +113,7 @@
"indexes": {
"diamonds_id_unique": {
"name": "diamonds_id_unique",
"columns": [
"id"
],
"columns": ["id"],
"isUnique": true
}
},
Expand All @@ -132,4 +128,4 @@
"tables": {},
"columns": {}
}
}
}
2 changes: 1 addition & 1 deletion drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"breakpoints": true
}
]
}
}
17 changes: 8 additions & 9 deletions src/routes/diamond/[address]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import WriteFacetMethods from './WriteFacetMethods.svelte'
import { page } from '$app/stores'
import { browser } from '$app/environment'
import { replaceState } from '$app/navigation'
import { pushState } from '$app/navigation'
export let data: PageData
let selectedTab = $page.url.hash.replace('#', '') || 'facets'
Expand All @@ -48,8 +48,13 @@
})
const disconnect = async () => {
if (!$connected) return
await disconnectWagmi()
if (browser) {
const url = `${$page.url.pathname}${$page.url.search}#${selectedTab}`
pushState(url, { url })
if (!$connected) return
await disconnectWagmi()
}
}
onDestroy(async () => {
Expand All @@ -59,12 +64,6 @@
$: if ($connected && $chainId !== chain.id) {
switchChain($wagmiConfig, { chainId: chain.id }).catch(() => disconnectWagmi())
}
$: {
if (browser) {
replaceState(`${$page.url.pathname}${$page.url.search}#${selectedTab}`, $page.state)
}
}
</script>

<div class="flex flex-col space-y-6">
Expand Down

0 comments on commit ade8be3

Please sign in to comment.