Skip to content

Commit

Permalink
fix: set block fetch interval
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed May 14, 2024
1 parent 6e8cb74 commit 6f8801f
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 48 deletions.
2 changes: 1 addition & 1 deletion app/app.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
packages = {
app = unstablePkgs.buildNpmPackage {
npmDepsHash = "sha256-Wt93AyaxFcyTlz5c1YPHiApCNNlMxcr2YIqJtuMQGuc=";
npmDepsHash = "sha256-HkwqQ1FdD6tJnD6sioeSjmZJ+Fc40CRjuTBnK7etsXs=";
src = ./.;
sourceRoot = "app";
npmFlags = [ "--legacy-peer-deps" ];
Expand Down
113 changes: 69 additions & 44 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"bits-ui": "^0.21.7",
"cmdk-sv": "^0.0.17",
"formsnap": "^1.0.0",
"gql.tada": "^1.6.3",
"gql.tada": "^1.7.0",
"graphql-request": "^6.1.0",
"graphql-ws": "^5.16.0",
"mode-watcher": "^0.3.0",
Expand Down Expand Up @@ -92,6 +92,6 @@
"vite": "^5.2.11",
"vite-plugin-inspect": "^0.8.4",
"vite-plugin-tailwind-purgecss": "^0.3.3",
"vitest": "^1.5.3"
"vitest": "^1.6.0"
}
}
9 changes: 9 additions & 0 deletions app/src/lib/graphql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
import { URLS } from "$lib/constants"
import { devtoolsExchange } from "@urql/devtools"
import { retryExchange } from "@urql/exchange-retry"
import { persistedExchange } from "@urql/exchange-persisted"
import { createClient as createWSClient, type SubscribePayload } from "graphql-ws"
import type { TadaPersistedDocumentNode } from "gql.tada"

const wsClient = createWSClient({
url: URLS.GRAPHQL_WSS,
Expand All @@ -20,6 +22,13 @@ export const graphqlClient = new Client({
exchanges: [
devtoolsExchange,
cacheExchange,
persistedExchange({
generateHash: async (_, document) => (document as TadaPersistedDocumentNode).documentId,
preferGetForPersistedQueries: true,
enforcePersistedQueries: true,
enableForMutation: true,
enableForSubscriptions: true
}),
fetchExchange,
subscriptionExchange({
forwardSubscription: operation => ({
Expand Down
5 changes: 4 additions & 1 deletion app/src/lib/queries/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export function blockHeightQuery() {
console.log(data)
return data.result.block.header.height
},
enabled: true
enabled: true,
// Union default block time
refetchInterval: 6_000,
refetchOnWindowFocus: false
})
}
9 changes: 9 additions & 0 deletions app/src/styles/reset.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
:root {
--default-accent: #A0ECFD;
}

* {
margin: 0;
scrollbar-width: 0.1rem;
scrollbar-color: transparent transparent;
}

input {
caret-shape: underscore;
caret-color: var(--default-accent);
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
Expand Down

0 comments on commit 6f8801f

Please sign in to comment.