strapi-plugin-magic-sessionmanager 4.14.1 → 4.14.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [4.14.2](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.14.1...v4.14.2) (2026-11-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **admin:** keep loads working when a component mounts again ([#24](https://github.com/Schero94/Magic-Sessionmanager/issues/24)) ([4a18a47](https://github.com/Schero94/Magic-Sessionmanager/commit/4a18a473c21aeb4ae0a5671f55456ce2b0abefcc))
7
+
8
+
9
+ ### Fixed
10
+
11
+ * The Online users widget, the Analytics page and the Configuration page no longer show "could not be loaded" after the component is mounted a second time. `useFetchClient` aborts the requests of an unmounted component; the widget and the Analytics page then skipped their next load because the aborted one still counted as running, and the Configuration page set the error of the aborted load after the next load had started. React StrictMode mounts every component twice in development, and React 19 and a future StrictMode admin do the same. Each load now belongs to one mount: an aborted or outdated load sets no state.
12
+
13
+ ### Tests
14
+
15
+ * `npm run test:admin`: StrictMode tests for every admin entry point (no duplicate requests, no leaked timers, listeners, connections or observers after unmount, no console errors or warnings), also run against React 19 in an informational CI job.
16
+
1
17
  ## [4.14.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.14.0...v4.14.1) (2026-11-18)
2
18
 
3
19
 
package/README.md CHANGED
@@ -960,6 +960,7 @@ Version 4.0.0 moved to Strapi 5 and its Document Service API. Upgrade Strapi its
960
960
  ```bash
961
961
  npm ci --legacy-peer-deps
962
962
  npm test # node --test tests/*.test.js tests/*.test.mjs
963
+ npm run test:admin # admin entry points in React.StrictMode (jsdom, fake network)
963
964
  npm run test:concurrency # 8 processes on one database (SQLite; PostgreSQL with MSM_TEST_PG_URL)
964
965
  npm run test:ts:front
965
966
  npm run test:ts:back
@@ -968,6 +969,8 @@ npm run verify
968
969
  npm run verify:runtime
969
970
  ```
970
971
 
972
+ `npm run test:admin` renders every admin entry point (the session dashboard and the admin panel sessions view with their dialogs, the Configuration and Analytics settings pages, the Online users widget and the Content Manager side panel) inside `React.StrictMode` with the providers of the Strapi admin, in jsdom with a fake network. It fails on a mutation sent twice, a read repeated without aborting the first one, an interval, listener, connection or observer left after unmount, and any console error or warning. A separate CI job runs the same tests against React 19 for information only: the plugin's peer range is React 18, like the Strapi 5 admin.
973
+
971
974
  HTTP integration tests need Strapi host dependencies: set `SESSION_HTTP_STRAPI_NODE_MODULES` to the `node_modules` of a Strapi 5 host; without it they skip with a message. This repository's own `node_modules` works (its devDependencies include Strapi 5.62 and Users & Permissions), which is what CI uses:
972
975
 
973
976
  ```bash
@@ -990,7 +993,7 @@ Releases use Conventional Commits and semantic-release on Node.js 22 with npm Tr
990
993
  Issues and pull requests are welcome.
991
994
 
992
995
  - Bugs and feature ideas: [open an issue](https://github.com/Schero94/Magic-Sessionmanager/issues/new/choose) (templates included). Questions: [Discussions](https://github.com/Schero94/Magic-Sessionmanager/discussions).
993
- - Pull requests: branch from `main`, write a failing test first, and use Conventional Commits (`fix:`, `feat:`, `docs:`; a breaking change needs a `BREAKING CHANGE:` footer). Before you push, run `npm run lint`, `npm run format:check`, `npm test`, both type checks and `npm run build && npm run verify`.
996
+ - Pull requests: branch from `main`, write a failing test first, and use Conventional Commits (`fix:`, `feat:`, `docs:`; a breaking change needs a `BREAKING CHANGE:` footer). Before you push, run `npm run lint`, `npm run format:check`, `npm test`, `npm run test:admin`, both type checks and `npm run build && npm run verify`.
994
997
  - Use synthetic data only in tests, screenshots and issues: `*.example.test` addresses and IP addresses from `203.0.113.0/24`. Never paste real tokens.
995
998
 
996
999
  ---
@@ -9,7 +9,7 @@ const styled = require("styled-components");
9
9
  const designSystem = require("@strapi/design-system");
10
10
  const icons = require("@strapi/icons");
11
11
  const symbols = require("@strapi/icons/symbols");
12
- const index = require("./index-BBZNey0n.js");
12
+ const index = require("./index-CmW1DJ0c.js");
13
13
  const SectionCard = require("./SectionCard-BlWv8CRt.js");
14
14
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
15
15
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -178,23 +178,29 @@ const AnalyticsPage = () => {
178
178
  const [updatedAt, setUpdatedAt] = react.useState(null);
179
179
  const [loadError, setLoadError] = react.useState(false);
180
180
  const [forbidden, setForbidden] = react.useState(false);
181
- const requestPendingRef = react.useRef(false);
181
+ const requestPendingRef = react.useRef(null);
182
182
  const fetchAnalytics = react.useCallback(async () => {
183
183
  if (requestPendingRef.current) return;
184
- requestPendingRef.current = true;
184
+ const request = {};
185
+ requestPendingRef.current = request;
186
+ const isCurrent = () => requestPendingRef.current === request;
185
187
  try {
186
188
  const { data } = await get(`/${index.pluginId}/sessions/analytics`);
189
+ if (!isCurrent()) return;
187
190
  setAnalytics(analyticsFromServer(data));
188
191
  setUpdatedAt(Date.now());
189
192
  setLoadError(false);
190
193
  } catch (err) {
194
+ if (!isCurrent() || index.isCancelledRequest(err)) return;
191
195
  index.logSafeAdminError("analytics.load", err);
192
196
  if (isForbidden(err)) setForbidden(true);
193
197
  setLoadError(true);
194
198
  } finally {
195
- requestPendingRef.current = false;
196
- setRefreshing(false);
197
- setLoading(false);
199
+ if (isCurrent()) {
200
+ requestPendingRef.current = null;
201
+ setRefreshing(false);
202
+ setLoading(false);
203
+ }
198
204
  }
199
205
  }, [get]);
200
206
  const handleRefresh = () => {
@@ -204,6 +210,9 @@ const AnalyticsPage = () => {
204
210
  };
205
211
  react.useEffect(() => {
206
212
  void fetchAnalytics();
213
+ return () => {
214
+ requestPendingRef.current = null;
215
+ };
207
216
  }, [fetchAnalytics]);
208
217
  if (loading) {
209
218
  return /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Page.Loading, {});
@@ -7,7 +7,7 @@ import styled from "styled-components";
7
7
  import { Typography, Flex, LinkButton, Button, EmptyStateLayout, VisuallyHidden } from "@strapi/design-system";
8
8
  import { ArrowClockwise, ChartBubble, User, Clock, Calendar } from "@strapi/icons";
9
9
  import { EmptyDocuments } from "@strapi/icons/symbols";
10
- import { K as normalizeDeviceType, u as useSessionFormatters, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, w as PageShell, x as StatGrid, y as StatCard, G as EqualGrid, b as getTranslation, L as getDeviceTypeMessage } from "./index-BcQdNWzu.mjs";
10
+ import { K as normalizeDeviceType, u as useSessionFormatters, l as pluginId, s as isCancelledRequest, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, w as PageShell, x as StatGrid, y as StatCard, G as EqualGrid, b as getTranslation, L as getDeviceTypeMessage } from "./index-C2SrNW6I.mjs";
11
11
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
12
12
  const ANALYTICS_UNKNOWN_KEY = "unknown";
13
13
  const VERSION_TOKEN = /^v?\d[\w.]*$/i;
@@ -174,23 +174,29 @@ const AnalyticsPage = () => {
174
174
  const [updatedAt, setUpdatedAt] = useState(null);
175
175
  const [loadError, setLoadError] = useState(false);
176
176
  const [forbidden, setForbidden] = useState(false);
177
- const requestPendingRef = useRef(false);
177
+ const requestPendingRef = useRef(null);
178
178
  const fetchAnalytics = useCallback(async () => {
179
179
  if (requestPendingRef.current) return;
180
- requestPendingRef.current = true;
180
+ const request = {};
181
+ requestPendingRef.current = request;
182
+ const isCurrent = () => requestPendingRef.current === request;
181
183
  try {
182
184
  const { data } = await get(`/${pluginId}/sessions/analytics`);
185
+ if (!isCurrent()) return;
183
186
  setAnalytics(analyticsFromServer(data));
184
187
  setUpdatedAt(Date.now());
185
188
  setLoadError(false);
186
189
  } catch (err) {
190
+ if (!isCurrent() || isCancelledRequest(err)) return;
187
191
  logSafeAdminError("analytics.load", err);
188
192
  if (isForbidden(err)) setForbidden(true);
189
193
  setLoadError(true);
190
194
  } finally {
191
- requestPendingRef.current = false;
192
- setRefreshing(false);
193
- setLoading(false);
195
+ if (isCurrent()) {
196
+ requestPendingRef.current = null;
197
+ setRefreshing(false);
198
+ setLoading(false);
199
+ }
194
200
  }
195
201
  }, [get]);
196
202
  const handleRefresh = () => {
@@ -200,6 +206,9 @@ const AnalyticsPage = () => {
200
206
  };
201
207
  useEffect(() => {
202
208
  void fetchAnalytics();
209
+ return () => {
210
+ requestPendingRef.current = null;
211
+ };
203
212
  }, [fetchAnalytics]);
204
213
  if (loading) {
205
214
  return /* @__PURE__ */ jsx(Page.Loading, {});
@@ -7,7 +7,7 @@ import { Typography, Flex, Loader, Button, Modal, Accordion, Box, IconButton, Li
7
7
  import { Earth, Duplicate, Cross, Eye, Trash, More, CaretDown, Download, ArrowClockwise, Check, Clock, User, ChartBubble, Cog, SignOut } from "@strapi/icons";
8
8
  import { EmptyDocuments } from "@strapi/icons/symbols";
9
9
  import styled, { useTheme } from "styled-components";
10
- import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, i as isSessionFilter, D as DEFAULT_SESSION_FILTER, c as isEndReasonFilter, d as DEFAULT_END_REASON_FILTER, e as getDevicePresentation, u as useSessionFormatters, f as getSessionStatus, h as isNativeOnlySession, j as getSessionEndReasonPresentation, k as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, o as pluginPermissions, M as MissingValue, V as ValueOrMissing, q as SESSION_STATES, r as SESSION_STATUS_PRESENTATION, s as isCancelledRequest, v as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, w as PageShell, x as StatGrid, y as StatCard, z as restoreDialogFocus, A as requireSessionList, B as getBadgeColors } from "./index-BcQdNWzu.mjs";
10
+ import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, i as isSessionFilter, D as DEFAULT_SESSION_FILTER, c as isEndReasonFilter, d as DEFAULT_END_REASON_FILTER, e as getDevicePresentation, u as useSessionFormatters, f as getSessionStatus, h as isNativeOnlySession, j as getSessionEndReasonPresentation, k as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, o as pluginPermissions, M as MissingValue, V as ValueOrMissing, q as SESSION_STATES, r as SESSION_STATUS_PRESENTATION, s as isCancelledRequest, v as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, w as PageShell, x as StatGrid, y as StatCard, z as restoreDialogFocus, A as requireSessionList, B as getBadgeColors } from "./index-C2SrNW6I.mjs";
11
11
  const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
12
12
  const { formatMessage } = useIntl();
13
13
  const key = reason || getSessionEndReason(session);
@@ -9,7 +9,7 @@ const designSystem = require("@strapi/design-system");
9
9
  const icons = require("@strapi/icons");
10
10
  const symbols = require("@strapi/icons/symbols");
11
11
  const styled = require("styled-components");
12
- const index = require("./index-BBZNey0n.js");
12
+ const index = require("./index-CmW1DJ0c.js");
13
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
14
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
15
15
  const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
@@ -6,7 +6,7 @@ import { Flex, Loader, Button, Box, Typography } from "@strapi/design-system";
6
6
  import { User, Lightning, Clock, Lock, WarningCircle } from "@strapi/icons";
7
7
  import * as StrapiAdmin from "@strapi/strapi/admin";
8
8
  import { useFetchClient } from "@strapi/strapi/admin";
9
- import { m as logSafeAdminError, s as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-BcQdNWzu.mjs";
9
+ import { m as logSafeAdminError, s as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-C2SrNW6I.mjs";
10
10
  function normalizeUserCounts(response) {
11
11
  const totalUsers = response?.data?.totalUsers;
12
12
  const blockedUsers = response?.data?.blockedUsers;
@@ -134,16 +134,19 @@ const OnlineUsersWidget = () => {
134
134
  const [userCounts, setUserCounts] = useState(null);
135
135
  const [loading, setLoading] = useState(true);
136
136
  const [loadError, setLoadError] = useState(false);
137
- const requestInProgress = useRef(false);
137
+ const requestInProgress = useRef(null);
138
138
  const fetchStats = useCallback(
139
139
  async ({ showLoading = true } = {}) => {
140
140
  if (requestInProgress.current) return;
141
- requestInProgress.current = true;
141
+ const request = {};
142
+ requestInProgress.current = request;
143
+ const isCurrent = () => requestInProgress.current === request;
142
144
  try {
143
145
  const [sessionResult, countResult] = await Promise.allSettled([
144
146
  get("/magic-sessionmanager/sessions/stats"),
145
147
  get("/magic-sessionmanager/users/stats")
146
148
  ]);
149
+ if (!isCurrent()) return;
147
150
  if (sessionResult.status === "rejected") throw sessionResult.reason;
148
151
  setStats(widgetStatsFromCounts(sessionResult.value?.data));
149
152
  setLoadError(false);
@@ -158,12 +161,14 @@ const OnlineUsersWidget = () => {
158
161
  if (showLoading) setUserCounts(null);
159
162
  }
160
163
  } catch (error) {
161
- if (isCancelledRequest(error)) return;
164
+ if (!isCurrent() || isCancelledRequest(error)) return;
162
165
  logSafeAdminError("onlineUsers.loadSessions", error);
163
166
  if (showLoading) setLoadError(true);
164
167
  } finally {
165
- if (showLoading) setLoading(false);
166
- requestInProgress.current = false;
168
+ if (isCurrent()) {
169
+ if (showLoading) setLoading(false);
170
+ requestInProgress.current = null;
171
+ }
167
172
  }
168
173
  },
169
174
  [get]
@@ -173,7 +178,10 @@ const OnlineUsersWidget = () => {
173
178
  const interval = setInterval(() => {
174
179
  void fetchStats({ showLoading: false });
175
180
  }, REFRESH_INTERVAL_MS);
176
- return () => clearInterval(interval);
181
+ return () => {
182
+ clearInterval(interval);
183
+ requestInProgress.current = null;
184
+ };
177
185
  }, [fetchStats]);
178
186
  if (loading) {
179
187
  return /* @__PURE__ */ jsx(LoadingState, { label: t("widget.loading", "Loading online users") });
@@ -7,7 +7,7 @@ const styled = require("styled-components");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const StrapiAdmin = require("@strapi/strapi/admin");
10
- const index = require("./index-BBZNey0n.js");
10
+ const index = require("./index-CmW1DJ0c.js");
11
11
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
12
12
  function _interopNamespace(e) {
13
13
  if (e && e.__esModule) return e;
@@ -155,16 +155,19 @@ const OnlineUsersWidget = () => {
155
155
  const [userCounts, setUserCounts] = react.useState(null);
156
156
  const [loading, setLoading] = react.useState(true);
157
157
  const [loadError, setLoadError] = react.useState(false);
158
- const requestInProgress = react.useRef(false);
158
+ const requestInProgress = react.useRef(null);
159
159
  const fetchStats = react.useCallback(
160
160
  async ({ showLoading = true } = {}) => {
161
161
  if (requestInProgress.current) return;
162
- requestInProgress.current = true;
162
+ const request = {};
163
+ requestInProgress.current = request;
164
+ const isCurrent = () => requestInProgress.current === request;
163
165
  try {
164
166
  const [sessionResult, countResult] = await Promise.allSettled([
165
167
  get("/magic-sessionmanager/sessions/stats"),
166
168
  get("/magic-sessionmanager/users/stats")
167
169
  ]);
170
+ if (!isCurrent()) return;
168
171
  if (sessionResult.status === "rejected") throw sessionResult.reason;
169
172
  setStats(widgetStatsFromCounts(sessionResult.value?.data));
170
173
  setLoadError(false);
@@ -179,12 +182,14 @@ const OnlineUsersWidget = () => {
179
182
  if (showLoading) setUserCounts(null);
180
183
  }
181
184
  } catch (error) {
182
- if (index.isCancelledRequest(error)) return;
185
+ if (!isCurrent() || index.isCancelledRequest(error)) return;
183
186
  index.logSafeAdminError("onlineUsers.loadSessions", error);
184
187
  if (showLoading) setLoadError(true);
185
188
  } finally {
186
- if (showLoading) setLoading(false);
187
- requestInProgress.current = false;
189
+ if (isCurrent()) {
190
+ if (showLoading) setLoading(false);
191
+ requestInProgress.current = null;
192
+ }
188
193
  }
189
194
  },
190
195
  [get]
@@ -194,7 +199,10 @@ const OnlineUsersWidget = () => {
194
199
  const interval = setInterval(() => {
195
200
  void fetchStats({ showLoading: false });
196
201
  }, REFRESH_INTERVAL_MS);
197
- return () => clearInterval(interval);
202
+ return () => {
203
+ clearInterval(interval);
204
+ requestInProgress.current = null;
205
+ };
198
206
  }, [fetchStats]);
199
207
  if (loading) {
200
208
  return /* @__PURE__ */ jsxRuntime.jsx(LoadingState, { label: t("widget.loading", "Loading online users") });
@@ -4,7 +4,7 @@ import { Field, Typography, Switch, Box, TextInput, Flex, Button, Link, SingleSe
4
4
  import { ConfirmDialog, useNotification, useFetchClient, useQueryParams, Page, Form, Blocker, useForm } from "@strapi/strapi/admin";
5
5
  import { EyeStriked, Eye, Key, Duplicate, Cross, Plus, Trash, Check } from "@strapi/icons";
6
6
  import styled from "styled-components";
7
- import { F as ReadableParagraphs, b as getTranslation, m as logSafeAdminError, R as ReadableText, G as EqualGrid, n as PersistentAlert, P as PropertyList, H as formatSessionDate, C as ConfirmAction, I as refocusIfLost, l as pluginId, J as requireSuccessfulMutation, w as PageShell } from "./index-BcQdNWzu.mjs";
7
+ import { F as ReadableParagraphs, b as getTranslation, m as logSafeAdminError, R as ReadableText, G as EqualGrid, n as PersistentAlert, P as PropertyList, H as formatSessionDate, C as ConfirmAction, I as refocusIfLost, l as pluginId, s as isCancelledRequest, J as requireSuccessfulMutation, w as PageShell } from "./index-C2SrNW6I.mjs";
8
8
  import { useIntl } from "react-intl";
9
9
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
10
10
  const SETTINGS_TAB_IDS = Object.freeze([
@@ -3107,6 +3107,7 @@ function useSettingsForm() {
3107
3107
  const settingsRef = useRef(settings);
3108
3108
  const savedSettingsRef = useRef(savedSettings);
3109
3109
  const revisionRef = useRef(null);
3110
+ const loadRequestRef = useRef(0);
3110
3111
  useLayoutEffect(() => {
3111
3112
  settingsRef.current = settings;
3112
3113
  savedSettingsRef.current = savedSettings;
@@ -3149,10 +3150,13 @@ function useSettingsForm() {
3149
3150
  }
3150
3151
  }, [get]);
3151
3152
  const fetchSettings = useCallback(async () => {
3153
+ const request = loadRequestRef.current + 1;
3154
+ loadRequestRef.current = request;
3152
3155
  setLoading(true);
3153
3156
  setLoadError(false);
3154
3157
  try {
3155
3158
  const response = await get(`/${pluginId}/settings`);
3159
+ if (request !== loadRequestRef.current) return;
3156
3160
  if (!response?.data?.settings || typeof response.data.settings !== "object" || Array.isArray(response.data.settings)) {
3157
3161
  throw new Error("Invalid settings response");
3158
3162
  }
@@ -3162,10 +3166,11 @@ function useSettingsForm() {
3162
3166
  setSavedSettings(nextSettings);
3163
3167
  await fetchGeoIpStatus();
3164
3168
  } catch (err) {
3169
+ if (request !== loadRequestRef.current || isCancelledRequest(err)) return;
3165
3170
  logSafeAdminError("settings.load", err);
3166
3171
  setLoadError(true);
3167
3172
  } finally {
3168
- setLoading(false);
3173
+ if (request === loadRequestRef.current) setLoading(false);
3169
3174
  }
3170
3175
  }, [get, fetchGeoIpStatus]);
3171
3176
  const fetchSettingsRef = useRef(fetchSettings);
@@ -6,7 +6,7 @@ const designSystem = require("@strapi/design-system");
6
6
  const StrapiAdmin = require("@strapi/strapi/admin");
7
7
  const icons = require("@strapi/icons");
8
8
  const styled = require("styled-components");
9
- const index = require("./index-BBZNey0n.js");
9
+ const index = require("./index-CmW1DJ0c.js");
10
10
  const reactIntl = require("react-intl");
11
11
  const SectionCard = require("./SectionCard-BlWv8CRt.js");
12
12
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -3111,6 +3111,7 @@ function useSettingsForm() {
3111
3111
  const settingsRef = react.useRef(settings);
3112
3112
  const savedSettingsRef = react.useRef(savedSettings);
3113
3113
  const revisionRef = react.useRef(null);
3114
+ const loadRequestRef = react.useRef(0);
3114
3115
  react.useLayoutEffect(() => {
3115
3116
  settingsRef.current = settings;
3116
3117
  savedSettingsRef.current = savedSettings;
@@ -3153,10 +3154,13 @@ function useSettingsForm() {
3153
3154
  }
3154
3155
  }, [get]);
3155
3156
  const fetchSettings = react.useCallback(async () => {
3157
+ const request = loadRequestRef.current + 1;
3158
+ loadRequestRef.current = request;
3156
3159
  setLoading(true);
3157
3160
  setLoadError(false);
3158
3161
  try {
3159
3162
  const response = await get(`/${index.pluginId}/settings`);
3163
+ if (request !== loadRequestRef.current) return;
3160
3164
  if (!response?.data?.settings || typeof response.data.settings !== "object" || Array.isArray(response.data.settings)) {
3161
3165
  throw new Error("Invalid settings response");
3162
3166
  }
@@ -3166,10 +3170,11 @@ function useSettingsForm() {
3166
3170
  setSavedSettings(nextSettings);
3167
3171
  await fetchGeoIpStatus();
3168
3172
  } catch (err) {
3173
+ if (request !== loadRequestRef.current || index.isCancelledRequest(err)) return;
3169
3174
  index.logSafeAdminError("settings.load", err);
3170
3175
  setLoadError(true);
3171
3176
  } finally {
3172
- setLoading(false);
3177
+ if (request === loadRequestRef.current) setLoading(false);
3173
3178
  }
3174
3179
  }, [get, fetchGeoIpStatus]);
3175
3180
  const fetchSettingsRef = react.useRef(fetchSettings);
@@ -1579,7 +1579,7 @@ const index = {
1579
1579
  id: `${pluginId}.plugin.name`,
1580
1580
  defaultMessage: pluginPkg.strapi.displayName
1581
1581
  },
1582
- Component: () => import("./App-BRj2qIUs.mjs"),
1582
+ Component: () => import("./App-B2JIOiNM.mjs"),
1583
1583
  permissions: pluginPermissions$1
1584
1584
  });
1585
1585
  app.addSettingsLink(
@@ -1595,7 +1595,7 @@ const index = {
1595
1595
  },
1596
1596
  id: "general",
1597
1597
  to: `${pluginId}/general`,
1598
- Component: () => import("./Settings-BNPO9cXS.mjs"),
1598
+ Component: () => import("./Settings-BFdr77zD.mjs"),
1599
1599
  permissions: pluginPermissions$1
1600
1600
  },
1601
1601
  {
@@ -1605,7 +1605,7 @@ const index = {
1605
1605
  },
1606
1606
  id: "analytics",
1607
1607
  to: `${pluginId}/analytics`,
1608
- Component: () => import("./Analytics-oW2QbDj4.mjs"),
1608
+ Component: () => import("./Analytics-DfDdcjMe.mjs"),
1609
1609
  permissions: pluginPermissions$1
1610
1610
  }
1611
1611
  ]
@@ -1631,7 +1631,7 @@ const index = {
1631
1631
  href: `/plugins/${pluginId}`
1632
1632
  },
1633
1633
  component: async () => {
1634
- const component = await import("./OnlineUsersWidget-wxDYyK5v.mjs");
1634
+ const component = await import("./OnlineUsersWidget-BOd7p_MF.mjs");
1635
1635
  return component.default;
1636
1636
  },
1637
1637
  id: "online-users-widget",
@@ -1582,7 +1582,7 @@ const index = {
1582
1582
  id: `${pluginId}.plugin.name`,
1583
1583
  defaultMessage: pluginPkg.strapi.displayName
1584
1584
  },
1585
- Component: () => Promise.resolve().then(() => require("./App-DcxqQfMT.js")),
1585
+ Component: () => Promise.resolve().then(() => require("./App-DzxXcTYs.js")),
1586
1586
  permissions: pluginPermissions$1
1587
1587
  });
1588
1588
  app.addSettingsLink(
@@ -1598,7 +1598,7 @@ const index = {
1598
1598
  },
1599
1599
  id: "general",
1600
1600
  to: `${pluginId}/general`,
1601
- Component: () => Promise.resolve().then(() => require("./Settings-XdBlPves.js")),
1601
+ Component: () => Promise.resolve().then(() => require("./Settings-DNgH9qRy.js")),
1602
1602
  permissions: pluginPermissions$1
1603
1603
  },
1604
1604
  {
@@ -1608,7 +1608,7 @@ const index = {
1608
1608
  },
1609
1609
  id: "analytics",
1610
1610
  to: `${pluginId}/analytics`,
1611
- Component: () => Promise.resolve().then(() => require("./Analytics-DSG3shUY.js")),
1611
+ Component: () => Promise.resolve().then(() => require("./Analytics-Box2STtg.js")),
1612
1612
  permissions: pluginPermissions$1
1613
1613
  }
1614
1614
  ]
@@ -1634,7 +1634,7 @@ const index = {
1634
1634
  href: `/plugins/${pluginId}`
1635
1635
  },
1636
1636
  component: async () => {
1637
- const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-CCTnV-aE.js"));
1637
+ const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-D4M4D6rm.js"));
1638
1638
  return component.default;
1639
1639
  },
1640
1640
  id: "online-users-widget",
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-BBZNey0n.js");
3
+ const index = require("./index-CmW1DJ0c.js");
4
4
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { N } from "./index-BcQdNWzu.mjs";
1
+ import { N } from "./index-C2SrNW6I.mjs";
2
2
  export {
3
3
  N as default
4
4
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.14.1",
2
+ "version": "4.14.2",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",
@@ -50,6 +50,7 @@
50
50
  "scripts": {
51
51
  "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
52
52
  "test": "node --test tests/*.test.js tests/*.test.mjs",
53
+ "test:admin": "node --import ./tests/admin/harness/setup.mjs --test \"tests/admin/*.test.jsx\"",
53
54
  "test:concurrency": "node scripts/concurrency/run.mjs",
54
55
  "test:ts:front": "tsc --noEmit --allowJs --jsx react-jsx --moduleResolution bundler --module esnext -p admin/jsconfig.json",
55
56
  "test:ts:back": "tsc --noEmit --allowJs --moduleResolution node --module commonjs -p server/jsconfig.json",
@@ -89,6 +90,7 @@
89
90
  "eslint-config-prettier": "^10.1.8",
90
91
  "eslint-plugin-react-hooks": "^7.1.1",
91
92
  "globals": "^17.14.0",
93
+ "jsdom": "^31.0.1",
92
94
  "pg": "^8.23.1",
93
95
  "prettier": "^3.9.10",
94
96
  "react": "^18.3.1",