@proofhound/web-ui 0.1.11 → 0.1.12

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.
@@ -15,4 +15,5 @@ export * from './token';
15
15
  export * from './use-auto-refresh';
16
16
  export * from './use-date-time-formatter';
17
17
  export * from './use-delayed-loading';
18
+ export * from './use-mounted';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
@@ -15,4 +15,5 @@ export * from './token';
15
15
  export * from './use-auto-refresh';
16
16
  export * from './use-date-time-formatter';
17
17
  export * from './use-delayed-loading';
18
+ export * from './use-mounted';
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Returns `false` during the server render and the client's first (hydration) render,
3
+ * flipping to `true` only after the component has mounted on the client.
4
+ *
5
+ * Use it as a hydration boundary for content that depends on client-only state — e.g. a
6
+ * React Query cache that is never prefetched/dehydrated on the server. Gating such content
7
+ * behind `useMounted()` guarantees the server output and the client's first paint render the
8
+ * same placeholder, then the real content appears after mount. Unlike `useDelayedLoading`
9
+ * (an anti-flicker timer), this establishes a deterministic first frame, so it is the correct
10
+ * tool for avoiding hydration mismatches.
11
+ */
12
+ export declare function useMounted(): boolean;
13
+ //# sourceMappingURL=use-mounted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-mounted.d.ts","sourceRoot":"","sources":["../../src/hooks/use-mounted.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAOpC"}
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ import { useEffect, useState } from 'react';
3
+ /**
4
+ * Returns `false` during the server render and the client's first (hydration) render,
5
+ * flipping to `true` only after the component has mounted on the client.
6
+ *
7
+ * Use it as a hydration boundary for content that depends on client-only state — e.g. a
8
+ * React Query cache that is never prefetched/dehydrated on the server. Gating such content
9
+ * behind `useMounted()` guarantees the server output and the client's first paint render the
10
+ * same placeholder, then the real content appears after mount. Unlike `useDelayedLoading`
11
+ * (an anti-flicker timer), this establishes a deterministic first frame, so it is the correct
12
+ * tool for avoiding hydration mismatches.
13
+ */
14
+ export function useMounted() {
15
+ const [mounted, setMounted] = useState(false);
16
+ useEffect(() => {
17
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: the post-mount flip is exactly what makes this a hydration boundary
18
+ setMounted(true);
19
+ }, []);
20
+ return mounted;
21
+ }
22
+ //# sourceMappingURL=use-mounted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-mounted.js","sourceRoot":"","sources":["../../src/hooks/use-mounted.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,GAAG,EAAE;QACb,+IAA+I;QAC/I,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"refine-provider.d.ts","sourceRoot":"","sources":["../../src/providers/refine-provider.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAYjD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAiBnE"}
1
+ {"version":3,"file":"refine-provider.d.ts","sourceRoot":"","sources":["../../src/providers/refine-provider.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA8BjD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAkBnE"}
@@ -4,16 +4,33 @@ import { Refine } from '@refinedev/core';
4
4
  import routerProvider from '@refinedev/nextjs-router';
5
5
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
6
6
  import { Suspense } from 'react';
7
- const queryClient = new QueryClient({
8
- defaultOptions: {
9
- queries: {
10
- retry: 1,
11
- staleTime: 30_000,
12
- refetchOnWindowFocus: true,
7
+ function makeQueryClient() {
8
+ return new QueryClient({
9
+ defaultOptions: {
10
+ queries: {
11
+ retry: 1,
12
+ staleTime: 30_000,
13
+ refetchOnWindowFocus: true,
14
+ },
13
15
  },
14
- },
15
- });
16
+ });
17
+ }
18
+ let browserQueryClient;
19
+ // TanStack's recommended SSR pattern: a fresh client per request on the server (so the cache
20
+ // never leaks across requests and every SSR starts from an empty cache for a deterministic
21
+ // first paint), and a reused singleton in the browser (so the cache survives Suspense, remounts
22
+ // and client-side navigations). The previous module-level singleton was shared across all
23
+ // server requests, which is both a cross-request data-leak hazard and a source of hydration
24
+ // mismatches (a warm server cache could render content the client's fresh first paint lacked).
25
+ function getQueryClient() {
26
+ if (typeof window === 'undefined') {
27
+ return makeQueryClient();
28
+ }
29
+ browserQueryClient ??= makeQueryClient();
30
+ return browserQueryClient;
31
+ }
16
32
  export function RefineProvider({ children }) {
33
+ const queryClient = getQueryClient();
17
34
  return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(Suspense, { fallback: null, children: _jsx(Refine, { routerProvider: routerProvider, options: {
18
35
  syncWithLocation: true,
19
36
  warnWhenUnsavedChanges: false,
@@ -1 +1 @@
1
- {"version":3,"file":"refine-provider.js","sourceRoot":"","sources":["../../src/providers/refine-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;IAClC,cAAc,EAAE;QACd,OAAO,EAAE;YACP,KAAK,EAAE,CAAC;YACR,SAAS,EAAE,MAAM;YACjB,oBAAoB,EAAE,IAAI;SAC3B;KACF;CACF,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAA2B;IAClE,OAAO,CACL,KAAC,mBAAmB,IAAC,MAAM,EAAE,WAAW,YACtC,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YACtB,KAAC,MAAM,IACL,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE;oBACP,gBAAgB,EAAE,IAAI;oBACtB,sBAAsB,EAAE,KAAK;oBAC7B,gBAAgB,EAAE,IAAI;iBACvB,YAEA,QAAQ,GACF,GACA,GACS,CACvB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"refine-provider.js","sourceRoot":"","sources":["../../src/providers/refine-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAEjD,SAAS,eAAe;IACtB,OAAO,IAAI,WAAW,CAAC;QACrB,cAAc,EAAE;YACd,OAAO,EAAE;gBACP,KAAK,EAAE,CAAC;gBACR,SAAS,EAAE,MAAM;gBACjB,oBAAoB,EAAE,IAAI;aAC3B;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,IAAI,kBAA2C,CAAC;AAEhD,6FAA6F;AAC7F,2FAA2F;AAC3F,gGAAgG;AAChG,0FAA0F;AAC1F,4FAA4F;AAC5F,+FAA+F;AAC/F,SAAS,cAAc;IACrB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,eAAe,EAAE,CAAC;IAC3B,CAAC;IACD,kBAAkB,KAAK,eAAe,EAAE,CAAC;IACzC,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAA2B;IAClE,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,OAAO,CACL,KAAC,mBAAmB,IAAC,MAAM,EAAE,WAAW,YACtC,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YACtB,KAAC,MAAM,IACL,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE;oBACP,gBAAgB,EAAE,IAAI;oBACtB,sBAAsB,EAAE,KAAK;oBAC7B,gBAAgB,EAAE,IAAI;iBACvB,YAEA,QAAQ,GACF,GACA,GACS,CACvB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proofhound/web-ui",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "ProofHound reusable product frontend: screens / hooks / providers / i18n / components / contracts",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -30,9 +30,9 @@
30
30
  "jsonc-parser": "3.3.1",
31
31
  "lucide-react": "^1.14.0",
32
32
  "recharts": "^3.3.1",
33
- "@proofhound/ui": "0.1.11",
34
- "@proofhound/api-client": "0.1.11",
35
- "@proofhound/shared": "0.1.11"
33
+ "@proofhound/ui": "0.1.12",
34
+ "@proofhound/api-client": "0.1.12",
35
+ "@proofhound/shared": "0.1.12"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "next": "^16",