@deenruv/admin-dashboard 1.0.17-dev.26 → 1.0.17-dev.27

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.
@@ -71,6 +71,7 @@ export const DeenruvAdminPanel = ({ plugins, settings }) => {
71
71
  ? getPermittedAdminRoutes([...builtInAdminRoutes, ...pluginRoutes], userPermissions)
72
72
  : [], [administratorAccessState, pluginRoutes, userPermissions]);
73
73
  const defaultRoute = administratorAccessState === 'ready' ? getDefaultAdminRoute(permittedRoutes) : undefined;
74
+ const routerRemountKey = useMemo(() => JSON.stringify([administratorAccessState, permittedRoutes.map(({ id }) => id)]), [administratorAccessState, permittedRoutes]);
74
75
  const createRouter = useCallback(() => createBrowserRouter(createAdminRouterRoutes({
75
76
  permittedRoutes,
76
77
  defaultRoute,
@@ -89,7 +90,7 @@ export const DeenruvAdminPanel = ({ plugins, settings }) => {
89
90
  root.classList.add(theme);
90
91
  }
91
92
  }, [theme]);
92
- return (_jsx(GlobalStoreProvider, { ...settings, children: _jsxs(I18nextProvider, { i18n: i18n, defaultNS: 'common', children: [_jsx(AnimatePresence, { children: isLoggedIn ? (_jsx(AdminAccessProvider, { value: { routes: permittedRoutes, defaultRoute }, children: _jsx(PluginProvider, { plugins: pluginsStore, context: context, children: _jsx(NotificationProvider, { notifications: [ORDER_STATUS_NOTIFICATION, SYSTEM_STATUS_NOTIFICATION].concat(pluginsStore.notifications), children: _jsx(CommittedRouterOwner, { createRouter: createRouter, children: (router) => _jsx(RouterProvider, { router: router }) }) }) }) })) : (_jsx(LoginScreen, {})) }), _jsx(Toaster, { theme: theme, className: "toaster group", richColors: true, expand: true, position: "bottom-right", toastOptions: {
93
+ return (_jsx(GlobalStoreProvider, { ...settings, children: _jsxs(I18nextProvider, { i18n: i18n, defaultNS: 'common', children: [_jsx(AnimatePresence, { children: isLoggedIn ? (_jsx(AdminAccessProvider, { value: { routes: permittedRoutes, defaultRoute }, children: _jsx(PluginProvider, { plugins: pluginsStore, context: context, children: _jsx(NotificationProvider, { notifications: [ORDER_STATUS_NOTIFICATION, SYSTEM_STATUS_NOTIFICATION].concat(pluginsStore.notifications), children: _jsx(CommittedRouterOwner, { createRouter: createRouter, remountKey: routerRemountKey, children: (router) => _jsx(RouterProvider, { router: router }) }) }) }) })) : (_jsx(LoginScreen, {})) }), _jsx(Toaster, { theme: theme, className: "toaster group", richColors: true, expand: true, position: "bottom-right", toastOptions: {
93
94
  classNames: {
94
95
  toast: 'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:p-4',
95
96
  title: 'group-[.toast]:font-semibold group-[.toast]:text-foreground',
@@ -2,15 +2,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Fragment, useLayoutEffect, useRef, useState } from 'react';
3
3
  import { Routes } from '@deenruv/react-ui-devkit';
4
4
  import { Navigate } from 'react-router';
5
- export const CommittedRouterOwner = ({ createRouter, children, }) => {
5
+ export const CommittedRouterOwner = ({ createRouter, remountKey, children, }) => {
6
6
  const [ownedRouter, setOwnedRouter] = useState();
7
7
  const activeRouter = useRef(undefined);
8
- const routerGeneration = useRef(0);
9
8
  const disposedRouters = useRef(new WeakSet());
10
9
  useLayoutEffect(() => {
11
10
  const nextRouter = createRouter();
12
11
  activeRouter.current = nextRouter;
13
- setOwnedRouter({ router: nextRouter, generation: ++routerGeneration.current });
12
+ setOwnedRouter({ router: nextRouter, remountKey });
14
13
  return () => {
15
14
  if (activeRouter.current === nextRouter) {
16
15
  activeRouter.current = undefined;
@@ -22,8 +21,8 @@ export const CommittedRouterOwner = ({ createRouter, children, }) => {
22
21
  }
23
22
  });
24
23
  };
25
- }, [createRouter]);
26
- return ownedRouter && activeRouter.current === ownedRouter.router ? (_jsx(Fragment, { children: children(ownedRouter.router) }, ownedRouter.generation)) : null;
24
+ }, [createRouter, remountKey]);
25
+ return ownedRouter && activeRouter.current === ownedRouter.router ? (_jsx(Fragment, { children: children(ownedRouter.router) }, ownedRouter.remountKey)) : null;
27
26
  };
28
27
  export const createAdminRouterRoutes = ({ permittedRoutes, defaultRoute, administratorAccessState, rootElement, errorElement, }) => {
29
28
  const children = permittedRoutes.map(({ id, path, element }) => ({ id, path, element }));
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const ADMIN_DASHBOARD_VERSION = '1.0.17-dev.26';
1
+ export const ADMIN_DASHBOARD_VERSION = '1.0.17-dev.27';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deenruv/admin-dashboard",
3
- "version": "1.0.17-dev.26",
3
+ "version": "1.0.17-dev.27",
4
4
  "main": "dist/index.js",
5
5
  "style": "dist/index.css",
6
6
  "types": "dist/index.d.ts",
@@ -80,10 +80,10 @@
80
80
  "yup": "^1.7.1",
81
81
  "zod": "^4.4.3",
82
82
  "zustand": "^5.0.14",
83
- "@deenruv/admin-dashboard": "1.0.17-dev.26",
84
- "@deenruv/admin-types": "1.0.17-dev.26",
85
- "@deenruv/deenruv-examples-plugin": "1.0.17-dev.26",
86
- "@deenruv/react-ui-devkit": "1.0.17-dev.26"
83
+ "@deenruv/admin-dashboard": "1.0.17-dev.27",
84
+ "@deenruv/deenruv-examples-plugin": "1.0.17-dev.27",
85
+ "@deenruv/admin-types": "1.0.17-dev.27",
86
+ "@deenruv/react-ui-devkit": "1.0.17-dev.27"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@tailwindcss/typography": "^0.5.20",