@schemavaults/auth-react-provider 0.16.6 → 0.16.8

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,7 +1,11 @@
1
1
  "use client";
2
- import useCurrentUser from "./use-current-user";
2
+ import useCurrentUserWithRevalidation from "./use-current-user-swr";
3
3
  export function useAdmin() {
4
- const currentUser = useCurrentUser();
4
+ // Sessions restored from the refresh-token cookie alone (e.g. after local
5
+ // storage was cleared, or a login performed outside this tab) have no
6
+ // in-memory user data, so the revalidating hook's whoami fallback is
7
+ // required for admin-gated UI to appear for them at all.
8
+ const currentUser = useCurrentUserWithRevalidation();
5
9
  return currentUser?.admin ?? false;
6
10
  }
7
11
  export default useAdmin;
@@ -1 +1 @@
1
- {"version":3,"file":"use-admin.js","sourceRoot":"","sources":["../../src/hooks/use-admin.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAEhD,MAAM,UAAU,QAAQ;IACtB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,OAAO,WAAW,EAAE,KAAK,IAAI,KAAK,CAAC;AACrC,CAAC;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"use-admin.js","sourceRoot":"","sources":["../../src/hooks/use-admin.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,8BAA8B,MAAM,wBAAwB,CAAC;AAEpE,MAAM,UAAU,QAAQ;IACtB,0EAA0E;IAC1E,sEAAsE;IACtE,qEAAqE;IACrE,yDAAyD;IACzD,MAAM,WAAW,GAAG,8BAA8B,EAAE,CAAC;IACrD,OAAO,WAAW,EAAE,KAAK,IAAI,KAAK,CAAC;AACrC,CAAC;AAED,eAAe,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@schemavaults/auth-react-provider",
3
3
  "description": "React hooks and components to make using the @schemavaults/auth-client-sdk a breeze",
4
- "version": "0.16.6",
4
+ "version": "0.16.8",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
7
7
  "repository": {
@@ -23,9 +23,9 @@
23
23
  "swr": "2.3.4"
24
24
  },
25
25
  "peerDependencies": {
26
- "next": "^16.2.6",
27
- "react": "^19.2.6",
28
- "react-dom": "^19.2.6"
26
+ "next": "^16.2.11",
27
+ "react": "^19.2.8",
28
+ "react-dom": "^19.2.8"
29
29
  },
30
30
  "scripts": {
31
31
  "build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",