Repository navigation
fix(admin): keep the shared schema cache alive across StrictMode remounts - #14
Merged
Merged
Conversation
npm run test:admin renders the bookmark page, the homepage widget, the Content Manager list view toolbar (popover, advanced filters) and the bookmark dialog inside React.StrictMode with the provider tree of the Strapi 5.62 admin test utils, in jsdom (31) with a fake network. It fails on a mutation sent twice, a GET repeated without aborting the first copy, any interval, listener, connection or observer left after unmount, and any console error or warning. CI runs it on React 18 and, informational only (peers stay React ^18), on React 19. Docs read: react.dev/reference/react/StrictMode, React 19 upgrade guide, @strapi/admin 5.62 dist/admin/admin/tests/utils.mjs and useFetchClient.mjs, Node 22 module customization hooks, esbuild 0.28 transform API, jsdom 31. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The /content-manager/init and list view configuration caches are shared by the toolbar, popover, widget and page, but their requests used the abort signal of the component that started them (useFetchClient aborts on unmount). In StrictMode, and whenever that component unmounted first, every other consumer got the aborted promise and showed raw content type ids or "Fields could not be loaded". The caches now use getFetchClient(). The bookmark dialog states that its title is its only label, so Radix no longer warns about a missing description. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 18, 2026
## [4.0.4](v4.0.3...v4.0.4) (2026-11-18) ### Bug Fixes * **admin:** keep the shared schema cache alive across StrictMode remounts ([#14](#14)) ([494ba2c](494ba2c)) ### Fixed * Content type names and filter fields load again after a component that started loading them unmounts. The schema cache (`/content-manager/init` and the list view configuration) is shared by the list view toolbar, the bookmark popover, the homepage widget and the bookmark page, but its requests ran on the abort signal of the first component; when that component unmounted (React StrictMode does this once on every mount), every other component got the aborted request and showed raw content type ids or "Fields could not be loaded". The cache now uses a fetch client that is not bound to one component. * The bookmark dialog no longer logs the Radix "Missing `Description`" warning: its title is its only label (`aria-describedby={undefined}`), as in the Advanced filters dialog since 4.0.3. ### Tests * `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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan item P2 (Strapi RFC strapi/strapi#27897 StrictMode, #25739 React 19).
Harness (
npm run test:admin)Renders each admin entry point inside
React.StrictModewith the provider tree Strapi 5.62 uses in its own admin tests (data router, StrapiAppProvider, Redux + adminApi, LanguageProvider, Theme, NotificationsProvider, AuthProvider, react-query, DnD, GuidedTour, Configuration, AppInfo). All@strapi/strapi/adminhooks and components are the real ones; onlyfetchis faked. jsdom 31 + esbuild 0.28 (devDependencies) through Node module hooks; same harness files as the other workbench plugins.Fails on: a mutation sent twice, a GET repeated without aborting the first copy, any interval/animation frame/window-document-body listener/WebSocket/EventSource/BroadcastChannel/socket.io/observer left after unmount, any console error or warning.
Entry points: bookmark page (list, not-found sub-path), homepage widget (data, empty, error), Content Manager list view toolbar (popover, advanced filters dialog, non-list routes), bookmark dialog (edit, shared, debounced user search).
Bugs fixed
admin/src/hooks/useSchemas.ts,useOpenBookmark.ts: the session-wide schema cache ran on the abort signal of the first component (useFetchClientaborts on unmount). On StrictMode's remount (or any unmount while another consumer waits) every consumer got the aborted promise: raw content type ids in widget/popover, "Fields could not be loaded" in advanced filters. Now usesgetFetchClient()(exported since 5.0, peer floor 5.57 checked). Regression: widget and toolbar tests fail with the fix stashed.BookmarkFormModal.tsx: Radix "MissingDescription" warning, fixed with the documented opt-out (as main did for the filters dialog in 4.0.3).CI
npm run test:adminin the Node 22/24 test job.react-19job, informational (continue-on-error: true): peers stay React^18like the Strapi 5 admin and are not widened.tests/package.test.cjsnow allowscontinue-on-erroronly inside that job.Docs read
react.dev/reference/react/StrictMode; react.dev/blog/2024/04/25/react-19-upgrade-guide;
@strapi/admin5.62dist/admin/admin/tests/utils.mjs,hooks/useFetchClient.mjs,utils/getFetchClient.mjs; unpkg@strapi/admin@5.57.0index.d.ts (getFetchClient export); Radix Dialog 1.1.5 DescriptionWarning source; Node 22 module customization hooks; esbuild transform API; jsdom 31 README.Gate: lint, format:check, npm test (121), test:admin (7), both type checks, build, verify, verify:runtime, npm pack --dry-run (no tests packed).
🤖 Generated with Claude Code