Merge pull request #1712 from strapi/fix/autoReload

Fix auto reload
This commit is contained in:
Jim LAURIE 2018-08-29 12:23:11 +02:00 committed by GitHub
commit ac00bce56b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 11 deletions

View File

@ -335,7 +335,8 @@ Most of the application's configurations are defined by environment. It means th
- `host` (string): Host name. Default value: `localhost`.
- `port` (integer): Port on which the server should be running. Default value: `1337`.
- `autoReload` (boolean): Enable or disabled server reload on files update. Default value: depends on the environment.
- `autoReload`
- `enabled` (boolean): Enable or disabled server reload on files update. Default value: depends on the environment.
- [`cron`](https://en.wikipedia.org/wiki/Cron)
- `enabled` (boolean): Enable or disable CRON tasks to schedule jobs at specific dates. Default value: `false`.
- `admin`

View File

@ -346,7 +346,7 @@ const send = require('koa-send');
module.exports = {
autoReload: async ctx => {
ctx.send({ autoReload: _.get(strapi.config.environments, 'development.server.autoReload', false) });
ctx.send({ autoReload: _.get(strapi.config.currentEnvironment, 'server.autoReload', { enabled: false }) });
}
}
```
@ -374,8 +374,8 @@ import request from 'utils/request';
const shouldRenderCompo = (plugin) => new Promise((resolve, request) => {
request('/my-plugin/autoReload')
.then(response => {
// If autoReload is enabled the response is `{ autoReload: true }`
plugin.preventComponentRendering = !response.autoReload;
// If autoReload is enabled the response is `{ autoReload: { enabled: true } }`
plugin.preventComponentRendering = !response.autoReload.enabled;
// Set the BlockerComponent props
plugin.blockerComponentProps = {
blockerComponentTitle: 'my-plugin.blocker.title',
@ -407,8 +407,8 @@ import MyCustomBlockerComponent from 'components/MyCustomBlockerComponent';
const shouldRenderCompo = (plugin) => new Promise((resolve, request) => {
request('/my-plugin/autoReload')
.then(response => {
// If autoReload is enabled the response is `{ autoReload: true }`
plugin.preventComponentRendering = !response.autoReload;
// If autoReload is enabled the response is `{ autoReload: { enabled: true } }`
plugin.preventComponentRendering = !response.autoReload.enabled;
// Tell which component to be rendered instead
plugin.blockerComponent = MyCustomBlockerComponent;

View File

@ -59,7 +59,7 @@ const renderIde = () => (
 "port": 1337,
<br />
<span style={{ color: '#006EE7'}}>
&nbsp;"autoReload": true,
&nbsp;"autoReload": &#123; enabled: true &#125;
</span>
<br />
&nbsp;"proxi": &#123;

View File

@ -190,7 +190,7 @@ module.exports = {
autoReload: async ctx => {
ctx.send({
autoReload: _.get(strapi.config.environments, 'development.server.autoReload', false),
autoReload: _.get(strapi.config.currentEnvironment, 'server.autoReload', { enabled: false })
});
},

View File

@ -3,7 +3,7 @@ import request from 'utils/request';
const shouldRenderCompo = (plugin) => new Promise((resolve, reject) => {
request('/settings-manager/autoReload')
.then(response => {
plugin.preventComponentRendering = !response.autoReload;
plugin.preventComponentRendering = !response.autoReload.enabled;
plugin.blockerComponentProps = {
blockerComponentTitle: 'components.AutoReloadBlocker.header',
blockerComponentDescription: 'components.AutoReloadBlocker.description',

View File

@ -334,8 +334,8 @@ module.exports = {
autoReload: async ctx => {
ctx.send({
autoReload: _.get(strapi.config.environments, 'development.server.autoReload', false),
environment: strapi.config.environment,
autoReload: _.get(strapi.config.currentEnvironment, 'server.autoReload', { enabled: false }),
environment: strapi.config.environment
});
}
};