@geomak/ui 6.24.0 → 6.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/dist/index.cjs +7 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5969,6 +5969,8 @@ function SecureLayout({
|
|
|
5969
5969
|
className = ""
|
|
5970
5970
|
}) {
|
|
5971
5971
|
const reduced = useReducedMotion();
|
|
5972
|
+
const cbs = useRef({ canAccess, onGranted, onDeny });
|
|
5973
|
+
cbs.current = { canAccess, onGranted, onDeny };
|
|
5972
5974
|
const rolesKey = JSON.stringify(roles);
|
|
5973
5975
|
const requiredRolesKey = JSON.stringify(requiredRoles);
|
|
5974
5976
|
const permissionsKey = JSON.stringify(permissions);
|
|
@@ -5987,18 +5989,19 @@ function SecureLayout({
|
|
|
5987
5989
|
);
|
|
5988
5990
|
useEffect(() => {
|
|
5989
5991
|
let cancelled = false;
|
|
5992
|
+
const { canAccess: check, onGranted: granted, onDeny: deny } = cbs.current;
|
|
5990
5993
|
const finish = (ok) => {
|
|
5991
5994
|
if (cancelled) return;
|
|
5992
5995
|
setState(ok ? "granted" : "denied");
|
|
5993
|
-
if (ok)
|
|
5994
|
-
else
|
|
5996
|
+
if (ok) granted?.();
|
|
5997
|
+
else deny?.();
|
|
5995
5998
|
};
|
|
5996
5999
|
if (!passesSync()) {
|
|
5997
6000
|
finish(false);
|
|
5998
|
-
} else if (!
|
|
6001
|
+
} else if (!check) {
|
|
5999
6002
|
finish(true);
|
|
6000
6003
|
} else {
|
|
6001
|
-
const result =
|
|
6004
|
+
const result = check(route);
|
|
6002
6005
|
if (result && typeof result.then === "function") {
|
|
6003
6006
|
setState("checking");
|
|
6004
6007
|
result.then((ok) => finish(Boolean(ok)));
|
|
@@ -6015,7 +6018,6 @@ function SecureLayout({
|
|
|
6015
6018
|
route,
|
|
6016
6019
|
requireAllRoles,
|
|
6017
6020
|
requireAllPermissions,
|
|
6018
|
-
canAccess,
|
|
6019
6021
|
rolesKey,
|
|
6020
6022
|
requiredRolesKey,
|
|
6021
6023
|
permissionsKey,
|