Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in CoreAdminUI in development mode #4432

Merged
merged 1 commit into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/simple/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ module.exports = {
'OptionTextElement',
'RedirectionSideEffect',
'RefreshSideEffect',
'AdminUIProps',
Copy link
Member Author

Choose a reason for hiding this comment

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

We should spend some time upgrading babel, this is forced by a bug that was fixed a few months ago

'AdminContextProps',
'AdminRouterProps',
]),
].concat(
process.env.NODE_ENV === 'development'
Expand Down
7 changes: 5 additions & 2 deletions packages/ra-core/src/core/CoreAdminUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const DefaultLayout: FunctionComponent<LayoutProps> = ({ children }) => (
<>{children}</>
);

export interface CoreAdminUIProps {
export interface AdminUIProps {
catchAll?: CatchAllComponent;
children?: AdminChildren;
customRoutes?: CustomRoutes;
Expand All @@ -33,7 +33,10 @@ export interface CoreAdminUIProps {
title?: TitleComponent;
}

const CoreAdminUI: FunctionComponent<CoreAdminUIProps> = ({
// for BC
export type CoreAdminUIProps = AdminUIProps;

const CoreAdminUI: FunctionComponent<AdminUIProps> = ({
catchAll = Noop,
children,
customRoutes = [],
Expand Down
9 changes: 6 additions & 3 deletions packages/ra-core/src/core/components.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import CoreAdmin from './CoreAdmin';
import CoreAdminContext from './CoreAdminContext';
import CoreAdminRouter from './CoreAdminRouter';
import CoreAdminUI from './CoreAdminUI';
import CoreAdminContext, { AdminContextProps } from './CoreAdminContext';
import CoreAdminRouter, { AdminRouterProps } from './CoreAdminRouter';
import CoreAdminUI, { AdminUIProps } from './CoreAdminUI';
import createAdminStore from './createAdminStore';
import RoutesWithLayout from './RoutesWithLayout';
import Resource from './Resource';

export {
CoreAdmin,
CoreAdminContext,
AdminContextProps,
CoreAdminRouter,
AdminRouterProps,
CoreAdminUI,
AdminUIProps,
createAdminStore,
RoutesWithLayout,
Resource,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { CoreAdminContext } from 'ra-core';
import React, { FC } from 'react';
import { CoreAdminContext, AdminContextProps } from 'ra-core';

import defaultI18nProvider from './defaultI18nProvider';

const AdminContext = CoreAdminContext;
const AdminContext: FC<AdminContextProps> = props => (
<CoreAdminContext {...props} />
);

AdminContext.defaultProps = {
i18nProvider: defaultI18nProvider,
Expand Down
10 changes: 0 additions & 10 deletions packages/react-admin/src/AdminRouter.ts

This file was deleted.

13 changes: 13 additions & 0 deletions packages/react-admin/src/AdminRouter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React, { FC } from 'react';
import { CoreAdminRouter, AdminRouterProps } from 'ra-core';
import { Loading } from 'ra-ui-materialui';

const AdminRouter: FC<AdminRouterProps> = props => (
<CoreAdminRouter {...props} />
);

AdminRouter.defaultProps = {
loading: Loading,
};

export default AdminRouter;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CoreAdminUI } from 'ra-core';
import React, { FC } from 'react';
import { CoreAdminUI, AdminUIProps } from 'ra-core';
import {
Layout as DefaultLayout,
Loading,
Expand All @@ -7,7 +8,7 @@ import {
NotFound,
} from 'ra-ui-materialui';

const AdminUI = CoreAdminUI;
const AdminUI: FC<AdminUIProps> = props => <CoreAdminUI {...props} />;

AdminUI.defaultProps = {
layout: DefaultLayout,
Expand All @@ -17,6 +18,4 @@ AdminUI.defaultProps = {
logout: Logout,
};

AdminUI.displayName = 'AdminUI';

export default AdminUI;