@rainlanguage/ui-components 0.0.1-alpha.62 → 0.0.1-alpha.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- <script generics="T">import { invalidateIdQuery } from "../queries/queryClient";
1
+ <script generics="T">import { invalidateTanstackQueries } from "../queries/queryClient";
2
2
  import Refresh from "./icon/Refresh.svelte";
3
3
  import { Button, Table, TableBody, TableBodyRow, TableHead } from "flowbite-svelte";
4
4
  import { createEventDispatcher } from "svelte";
@@ -21,9 +21,8 @@ export let rowHoverable = true;
21
21
  spin={$query.isLoading || $query.isFetching}
22
22
  on:click={async () => {
23
23
  if (queryKey) {
24
- await invalidateIdQuery(queryClient, queryKey);
24
+ invalidateTanstackQueries(queryClient, [queryKey]);
25
25
  }
26
- $query.refetch();
27
26
  }}
28
27
  />
29
28
  </div>
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
2
2
  import type { CreateInfiniteQueryResult, InfiniteData } from '@tanstack/svelte-query';
3
3
  declare class __sveltets_Render<T> {
4
4
  props(): {
5
- queryKey: string | undefined;
5
+ queryKey: string;
6
6
  query: CreateInfiniteQueryResult<InfiniteData<T[], unknown>, Error>;
7
7
  emptyMessage?: string;
8
8
  rowHoverable?: boolean;
@@ -16,7 +16,7 @@ import { onDestroy } from "svelte";
16
16
  import OrderApy from "../tables/OrderAPY.svelte";
17
17
  import { page } from "$app/stores";
18
18
  import Refresh from "../icon/Refresh.svelte";
19
- import { invalidateIdQuery } from "../../queries/queryClient";
19
+ import { invalidateTanstackQueries } from "../../queries/queryClient";
20
20
  import { ArrowDownOutline, ArrowUpOutline, InfoCircleOutline } from "flowbite-svelte-icons";
21
21
  import { useAccount } from "../../providers/wallet/useAccount";
22
22
  import {
@@ -46,7 +46,7 @@ $: orderDetailQuery = createQuery({
46
46
  enabled: !!subgraphUrl
47
47
  });
48
48
  const interval = setInterval(async () => {
49
- await invalidateIdQuery(queryClient, orderHash);
49
+ await invalidateTanstackQueries(queryClient, [orderHash]);
50
50
  }, 1e4);
51
51
  onDestroy(() => {
52
52
  clearInterval(interval);
@@ -80,7 +80,7 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
80
80
 
81
81
  <Refresh
82
82
  testId="top-refresh"
83
- on:click={async () => await invalidateIdQuery(queryClient, orderHash)}
83
+ on:click={() => invalidateTanstackQueries(queryClient, [orderHash])}
84
84
  spin={$orderDetailQuery.isLoading || $orderDetailQuery.isFetching}
85
85
  />
86
86
  </div>
@@ -1,4 +1,4 @@
1
- <script generics="T">import { invalidateIdQuery } from "../../queries/queryClient";
1
+ <script generics="T">import { invalidateTanstackQueries } from "../../queries/queryClient";
2
2
  import Refresh from "../icon/Refresh.svelte";
3
3
  import EditableSpan from "../EditableSpan.svelte";
4
4
  import { getOrderQuote } from "@rainlanguage/orderbook";
@@ -23,7 +23,7 @@ export let handleQuoteDebugModal = void 0;
23
23
  let enabled = true;
24
24
  const queryClient = useQueryClient();
25
25
  const refreshQuotes = async () => {
26
- await invalidateIdQuery(queryClient, id);
26
+ invalidateTanstackQueries(queryClient, [id, QKEY_ORDER_QUOTE + id]);
27
27
  };
28
28
  $: orderQuoteQuery = createQuery({
29
29
  queryKey: [id, QKEY_ORDER_QUOTE + id],
@@ -12,7 +12,7 @@ import { onDestroy } from "svelte";
12
12
  import { useQueryClient } from "@tanstack/svelte-query";
13
13
  import OrderOrVaultHash from "../OrderOrVaultHash.svelte";
14
14
  import Refresh from "../icon/Refresh.svelte";
15
- import { invalidateIdQuery } from "../../queries/queryClient";
15
+ import { invalidateTanstackQueries } from "../../queries/queryClient";
16
16
  import { useAccount } from "../../providers/wallet/useAccount";
17
17
  import { Button } from "flowbite-svelte";
18
18
  import { ArrowDownOutline, ArrowUpOutline } from "flowbite-svelte-icons";
@@ -39,11 +39,7 @@ const updateActiveNetworkAndOrderbook = (subgraphName) => {
39
39
  activeOrderbookRef.set(subgraphName);
40
40
  };
41
41
  const interval = setInterval(async () => {
42
- await queryClient.invalidateQueries({
43
- queryKey: [id],
44
- refetchType: "active",
45
- exact: false
46
- });
42
+ invalidateTanstackQueries(queryClient, [id, QKEY_VAULT + id]);
47
43
  }, 5e3);
48
44
  onDestroy(() => {
49
45
  clearInterval(interval);
@@ -81,7 +77,8 @@ onDestroy(() => {
81
77
  {/if}
82
78
 
83
79
  <Refresh
84
- on:click={async () => await invalidateIdQuery(queryClient, id)}
80
+ testId="top-refresh"
81
+ on:click={() => invalidateTanstackQueries(queryClient, [id, QKEY_VAULT + id])}
85
82
  spin={$vaultDetailQuery.isLoading || $vaultDetailQuery.isFetching}
86
83
  />
87
84
  </div>
@@ -87,7 +87,7 @@ $: isOrdersPage = currentRoute.startsWith("/orders");
87
87
 
88
88
  <AppTable
89
89
  {query}
90
- queryKey={undefined}
90
+ queryKey={QKEY_ORDERS}
91
91
  emptyMessage="No Orders Found"
92
92
  on:clickRow={(e) => {
93
93
  activeNetworkRef.set(e.detail.item.subgraphName);
@@ -30,7 +30,7 @@ const AppTable = TanstackAppTable;
30
30
 
31
31
  <AppTable
32
32
  query={balanceChangesQuery}
33
- queryKey={undefined}
33
+ queryKey={id}
34
34
  emptyMessage="No deposits or withdrawals found"
35
35
  rowHoverable={false}
36
36
  >
@@ -93,7 +93,7 @@ const AppTable = TanstackAppTable;
93
93
  />
94
94
  <AppTable
95
95
  {query}
96
- queryKey={undefined}
96
+ queryKey={QKEY_VAULTS}
97
97
  emptyMessage="No Vaults Found"
98
98
  on:clickRow={(e) => {
99
99
  updateActiveNetworkAndOrderbook(e.detail.item.subgraphName);
package/dist/index.d.ts CHANGED
@@ -76,6 +76,7 @@ export { bigintStringToHex, HEX_INPUT_REGEX } from './utils/hex';
76
76
  export { vaultBalanceDisplay } from './utils/vault';
77
77
  export { bigintToFloat } from './utils/number';
78
78
  export { getExplorerLink } from './services/getExplorerLink';
79
+ export { invalidateTanstackQueries } from './queries/queryClient';
79
80
  export { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL } from './queries/constants';
80
81
  export { QKEY_VAULTS, QKEY_VAULT, QKEY_VAULT_CHANGES, QKEY_ORDERS, QKEY_ORDER, QKEY_ORDER_TRADES_LIST, QKEY_ORDER_QUOTE, QKEY_VAULTS_VOL_LIST, QKEY_ORDER_APY } from './queries/keys';
81
82
  export { darkChartTheme, lightChartTheme } from './utils/lightweightChartsThemes';
package/dist/index.js CHANGED
@@ -73,6 +73,7 @@ export { bigintStringToHex, HEX_INPUT_REGEX } from './utils/hex';
73
73
  export { vaultBalanceDisplay } from './utils/vault';
74
74
  export { bigintToFloat } from './utils/number';
75
75
  export { getExplorerLink } from './services/getExplorerLink';
76
+ export { invalidateTanstackQueries } from './queries/queryClient';
76
77
  // Constants
77
78
  export { DEFAULT_PAGE_SIZE, DEFAULT_REFRESH_INTERVAL } from './queries/constants';
78
79
  export { QKEY_VAULTS, QKEY_VAULT, QKEY_VAULT_CHANGES, QKEY_ORDERS, QKEY_ORDER, QKEY_ORDER_TRADES_LIST, QKEY_ORDER_QUOTE, QKEY_VAULTS_VOL_LIST, QKEY_ORDER_APY } from './queries/keys';
@@ -1,3 +1,3 @@
1
1
  import { QueryClient } from '@tanstack/svelte-query';
2
2
  export declare const queryClient: QueryClient;
3
- export declare const invalidateIdQuery: (queryClient: QueryClient, id: string) => Promise<void>;
3
+ export declare const invalidateTanstackQueries: (queryClient: QueryClient, queryKey: string[]) => void;
@@ -7,9 +7,9 @@ export const queryClient = new QueryClient({
7
7
  }
8
8
  }
9
9
  });
10
- export const invalidateIdQuery = async (queryClient, id) => {
11
- await queryClient.invalidateQueries({
12
- queryKey: [id],
10
+ export const invalidateTanstackQueries = (queryClient, queryKey) => {
11
+ queryClient.invalidateQueries({
12
+ queryKey,
13
13
  refetchType: 'all',
14
14
  exact: false
15
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainlanguage/ui-components",
3
- "version": "0.0.1-alpha.62",
3
+ "version": "0.0.1-alpha.63",
4
4
  "description": "A component library for building Svelte applications to be used with Raindex.",
5
5
  "license": "LicenseRef-DCL-1.0",
6
6
  "author": "Rain Open Source Software Ltd",
@@ -53,7 +53,7 @@
53
53
  "@fontsource/dm-sans": "5.1.0",
54
54
  "@imask/svelte": "7.6.1",
55
55
  "@observablehq/plot": "0.6.16",
56
- "@rainlanguage/orderbook": "0.0.1-alpha.62",
56
+ "@rainlanguage/orderbook": "0.0.1-alpha.63",
57
57
  "@reown/appkit": "1.6.4",
58
58
  "@reown/appkit-adapter-wagmi": "1.6.4",
59
59
  "@sentry/sveltekit": "7.120.0",