diff --git a/packages/strapi-admin/admin/src/containers/Admin/index.js b/packages/strapi-admin/admin/src/containers/Admin/index.js index 49e79040a4..e56d8038b6 100644 --- a/packages/strapi-admin/admin/src/containers/Admin/index.js +++ b/packages/strapi-admin/admin/src/containers/Admin/index.js @@ -144,6 +144,7 @@ export class Admin extends React.Component { return ( { const [reducerState, dispatch] = useReducer(reducer, initialState, init); const [infoModals, toggleInfoModal] = useState({ cancel: false }); const { + autoReload, currentEnvironment, emitEvent, formatMessage, @@ -59,7 +60,10 @@ const DataManagerProvider = ({ allIcons, children }) => { const componentMatch = useRouteMatch( `/plugins/${pluginId}/component-categories/:categoryUid/:componentUid` ); - const isInDevelopmentMode = currentEnvironment === 'development'; + const formatMessageRef = useRef(); + formatMessageRef.current = formatMessage; + const isInDevelopmentMode = + currentEnvironment === 'development' && autoReload; const isInContentTypeView = contentTypeMatch !== null; const firstKeyToMainSchema = isInContentTypeView @@ -120,6 +124,16 @@ const DataManagerProvider = ({ allIcons, children }) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [isLoading, pathname]); + useEffect(() => { + if (currentEnvironment === 'development' && !autoReload) { + strapi.notification.info( + formatMessageRef.current({ + id: getTrad('notification.info.autoreaload-disable'), + }) + ); + } + }, [autoReload, currentEnvironment]); + const didModifiedComponents = getCreatedAndModifiedComponents(modifiedData.components || {}, components) .length > 0; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json b/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json index f25cf4b56b..a5e605a5ba 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json +++ b/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json @@ -132,6 +132,7 @@ "modelPage.attribute.relationWith": "Relation with", "modelPage.contentHeader.emptyDescription.description": "There is no description", "notification.info.creating.notSaved": "Please save your work before creating a new content type or component", + "notification.info.autoreaload-disable": "The autoReload feature is required to use this plugin. Start your server with `strapi develop`", "plugin.description.long": "Modelize the data structure of your API. Create new fields and relations in just a minute. The files are automatically created and updated in your project.", "plugin.description.short": "Modelize the data structure of your API.", "popUpForm.navContainer.advanced": "Advanced settings",