mirror of
https://github.com/strapi/strapi.git
synced 2025-08-13 19:27:34 +00:00
Fix content-type creation bug in content-manager
This commit is contained in:
parent
3c9434c024
commit
be5f28260b
@ -4,7 +4,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { LOAD_MODELS, LOADED_MODELS, UPDATE_SCHEMA } from './constants';
|
import { EMPTY_STORE, LOAD_MODELS, LOADED_MODELS, UPDATE_SCHEMA } from './constants';
|
||||||
|
|
||||||
|
export function emptyStore() {
|
||||||
|
return {
|
||||||
|
type: EMPTY_STORE,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function loadModels() {
|
export function loadModels() {
|
||||||
return {
|
return {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export const EMPTY_STORE = 'contentManager/App/EMPTY_STORE';
|
||||||
export const LOAD_MODELS = 'contentManager/App/LOAD_MODELS';
|
export const LOAD_MODELS = 'contentManager/App/LOAD_MODELS';
|
||||||
export const LOADED_MODELS = 'contentManager/App/LOADED_MODELS';
|
export const LOADED_MODELS = 'contentManager/App/LOADED_MODELS';
|
||||||
export const UPDATE_SCHEMA = 'contentManager/App/UPDATE_SCHEMA';
|
export const UPDATE_SCHEMA = 'contentManager/App/UPDATE_SCHEMA';
|
||||||
|
@ -19,7 +19,7 @@ import Home from 'containers/Home';
|
|||||||
import Edit from 'containers/Edit';
|
import Edit from 'containers/Edit';
|
||||||
import List from 'containers/List';
|
import List from 'containers/List';
|
||||||
|
|
||||||
import { loadModels, updateSchema } from './actions';
|
import { emptyStore, loadModels, updateSchema } from './actions';
|
||||||
import { makeSelectLoading } from './selectors';
|
import { makeSelectLoading } from './selectors';
|
||||||
|
|
||||||
import saga from './sagas';
|
import saga from './sagas';
|
||||||
@ -43,6 +43,10 @@ class App extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.props.emptyStore();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.props.loading) {
|
if (this.props.loading) {
|
||||||
return <div />;
|
return <div />;
|
||||||
@ -65,6 +69,7 @@ App.contextTypes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
App.propTypes = {
|
App.propTypes = {
|
||||||
|
emptyStore: PropTypes.func.isRequired,
|
||||||
loading: PropTypes.bool.isRequired,
|
loading: PropTypes.bool.isRequired,
|
||||||
loadModels: PropTypes.func.isRequired,
|
loadModels: PropTypes.func.isRequired,
|
||||||
updateSchema: PropTypes.func.isRequired,
|
updateSchema: PropTypes.func.isRequired,
|
||||||
@ -73,6 +78,7 @@ App.propTypes = {
|
|||||||
export function mapDispatchToProps(dispatch) {
|
export function mapDispatchToProps(dispatch) {
|
||||||
return bindActionCreators(
|
return bindActionCreators(
|
||||||
{
|
{
|
||||||
|
emptyStore,
|
||||||
loadModels,
|
loadModels,
|
||||||
updateSchema,
|
updateSchema,
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { fromJS, List } from 'immutable';
|
import { fromJS, List } from 'immutable';
|
||||||
|
|
||||||
import { LOAD_MODELS, LOADED_MODELS, UPDATE_SCHEMA } from './constants';
|
import { EMPTY_STORE, LOAD_MODELS, LOADED_MODELS, UPDATE_SCHEMA } from './constants';
|
||||||
|
|
||||||
const initialState = fromJS({
|
const initialState = fromJS({
|
||||||
loading: true,
|
loading: true,
|
||||||
@ -17,6 +17,12 @@ const initialState = fromJS({
|
|||||||
|
|
||||||
function appReducer(state = initialState, action) {
|
function appReducer(state = initialState, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
case EMPTY_STORE:
|
||||||
|
return state
|
||||||
|
.set('loading', true)
|
||||||
|
.set('models', false)
|
||||||
|
.set('schema', false)
|
||||||
|
.set('formValidations', List());
|
||||||
case LOAD_MODELS:
|
case LOAD_MODELS:
|
||||||
return state;
|
return state;
|
||||||
case LOADED_MODELS:
|
case LOADED_MODELS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user