@versini/auth0-react-thin 2.24.0 → 2.24.1
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.
- package/README.md +1 -1
- package/dist/auth0-react.cjs.js +5 -24
- package/dist/auth0-react.cjs.js.map +1 -1
- package/dist/auth0-react.esm.js +8 -9
- package/dist/auth0-react.esm.js.map +1 -1
- package/dist/auth0-react.js +5 -24
- package/dist/auth0-react.js.map +1 -1
- package/dist/auth0-react.min.js +1 -1
- package/dist/auth0-react.min.js.map +1 -1
- package/dist/use-auth0-suspense.d.ts +1 -1
- package/dist/use-auth0-suspense.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/use-auth0-suspense.tsx +8 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-auth0-suspense.d.ts","sourceRoot":"","sources":["../src/use-auth0-suspense.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-auth0-suspense.d.ts","sourceRoot":"","sources":["../src/use-auth0-suspense.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAEtE;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,CAAC,KAAK,SAAS,IAAI,GAAG,IAAI,IAAI,IAAI,CACzE,qBAAqB,CAAC,KAAK,CAAC,EAC5B,WAAW,GAAG,cAAc,CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,gBAAgB,GAAI,KAAK,SAAS,IAAI,GAAG,IAAI,EACjD,oDAAsB,KACrB,6BAA6B,CAAC,KAAK,CA0BrC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Auth0",
|
|
3
3
|
"name": "@versini/auth0-react-thin",
|
|
4
|
-
"version": "2.24.
|
|
5
|
-
"description": "Unofficial slim fork of @auth0/auth0-react@2.24.
|
|
4
|
+
"version": "2.24.1",
|
|
5
|
+
"description": "Unofficial slim fork of @auth0/auth0-react@2.24.1 — bundle-size build, not affiliated with Auth0/Okta. See @versini/auth0-thin.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"auth0",
|
|
8
8
|
"fork",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@auth0/auth0-spa-js": "^2.24.1"
|
|
36
36
|
},
|
|
37
|
-
"forkedFrom": "@auth0/auth0-react@2.24.
|
|
37
|
+
"forkedFrom": "@auth0/auth0-react@2.24.1",
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// never call this hook.
|
|
4
|
-
import
|
|
1
|
+
// Default import, NOT `import * as React`: webpack checks namespace member names
|
|
2
|
+
// against the module's export list, so `React.use` on a namespace binding warns
|
|
3
|
+
// for React 16-18 consumers even if they never call this hook (#1205). A default
|
|
4
|
+
// import is react's module.exports object, so the read is unchecked. Named
|
|
5
|
+
// (`import { use }`) is worse still: it fails at link time.
|
|
6
|
+
import React, { useContext, useMemo } from 'react';
|
|
5
7
|
import { User } from '@auth0/auth0-spa-js';
|
|
6
8
|
import Auth0Context, { Auth0ContextInterface } from './auth0-context';
|
|
7
9
|
|
|
@@ -47,7 +49,7 @@ const useAuth0Suspense = <TUser extends User = User>(
|
|
|
47
49
|
);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
const ctx =
|
|
52
|
+
const ctx = useContext(context) as Auth0ContextInterface<TUser>;
|
|
51
53
|
|
|
52
54
|
if (!ctx._initPromise) {
|
|
53
55
|
throw new Error(
|
|
@@ -61,7 +63,7 @@ const useAuth0Suspense = <TUser extends User = User>(
|
|
|
61
63
|
// Memoized so the returned object is referentially stable across renders,
|
|
62
64
|
// matching useAuth0, which hands back the provider's memoized context.
|
|
63
65
|
// Without this, `useEffect(..., [auth])` in a consumer re-runs every render.
|
|
64
|
-
return
|
|
66
|
+
return useMemo(() => {
|
|
65
67
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
66
68
|
const { isLoading, _initPromise, ...rest } = ctx;
|
|
67
69
|
return rest;
|