Skip to content

fix(AdminGuesser): respect passed loading prop in AdminGuesser#651

Merged
slax57 merged 1 commit intoapi-platform:mainfrom
djaszak:main
Feb 26, 2026
Merged

fix(AdminGuesser): respect passed loading prop in AdminGuesser#651
slax57 merged 1 commit intoapi-platform:mainfrom
djaszak:main

Conversation

@djaszak
Copy link
Contributor

@djaszak djaszak commented Feb 25, 2026

Q A
Branch? main
Tickets Partly closes #632
License MIT
Doc PR api-platform/docs#...

This PR aims to fix the problem of not being able to override the used <Loading /> component in the <AdminGuesser /> component. The <AdminGuesser /> already accepts an alternative <Loading /> component, so using it just seems natural. It partly fixes the related issue of it being non-translated, as one can pass a component with either no description or some hard-coded string or similar

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes AdminGuesser so the loading prop (custom loading component) is actually respected during the initial introspection loading phase, aligning behavior with the existing AdminProps contract and helping address issue #632.

Changes:

  • Default/destructure loading as a LoadingPage component and render it during initial loading state.
  • Propagate the same LoadingPage component down to AdminResourcesGuesser via loadingPage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 99 to +100
if (loading) {
return <Loading />;
return <LoadingPage />;
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior change (using the caller-provided loading component during the initial introspection load) isn’t covered by tests. Current AdminGuesser.test.tsx uses shallow rendering, so it won’t run useEffect or exercise the if (loading) return <LoadingPage /> branch with a custom loading prop. Add a test that mounts AdminGuesser (e.g., with @testing-library/react) and asserts that a custom loading component is rendered before dataProvider.introspect() resolves.

Copilot uses AI. Check for mistakes.
@slax57 slax57 added this to the 4.0.9 milestone Feb 26, 2026
@slax57 slax57 merged commit 337e506 into api-platform:main Feb 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loading text is not working correctly and showing "ra.loading.page"

4 participants