mirror of
https://github.com/strapi/strapi.git
synced 2025-12-16 01:34:23 +00:00
Fix layout update from ctb
This commit is contained in:
parent
53d0014dc2
commit
5e94cf56f7
@ -7,16 +7,25 @@
|
||||
},
|
||||
"options": {
|
||||
"increments": true,
|
||||
"timestamps": true,
|
||||
"timestamps": [
|
||||
"created_at",
|
||||
"updated_at"
|
||||
],
|
||||
"comment": ""
|
||||
},
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"rocketshipmaker": {
|
||||
"model": "rocketshipmaker",
|
||||
"via": "rocketships"
|
||||
"pic": {
|
||||
"model": "file",
|
||||
"via": "related",
|
||||
"plugin": "upload"
|
||||
},
|
||||
"pictures": {
|
||||
"collection": "file",
|
||||
"via": "related",
|
||||
"plugin": "upload"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,10 +13,6 @@
|
||||
"attributes": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"rocketships": {
|
||||
"collection": "rocketship",
|
||||
"via": "rocketshipmaker"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,12 +210,12 @@ input editRecipeInput {
|
||||
|
||||
input editRocketshipInput {
|
||||
name: String
|
||||
rocketshipmaker: ID
|
||||
pic: ID
|
||||
pictures: [ID]
|
||||
}
|
||||
|
||||
input editRocketshipmakerInput {
|
||||
name: String
|
||||
rocketships: [ID]
|
||||
}
|
||||
|
||||
input editRoleInput {
|
||||
@ -392,7 +392,8 @@ input RecipeInput {
|
||||
|
||||
type Rocketship {
|
||||
name: String
|
||||
rocketshipmaker: Rocketshipmaker
|
||||
pic: UploadFile
|
||||
pictures(sort: String, limit: Int, start: Int, where: JSON): [UploadFile]
|
||||
id: ID!
|
||||
created_at: DateTime!
|
||||
updated_at: DateTime!
|
||||
@ -400,12 +401,12 @@ type Rocketship {
|
||||
|
||||
input RocketshipInput {
|
||||
name: String
|
||||
rocketshipmaker: ID
|
||||
pic: ID
|
||||
pictures: [ID]
|
||||
}
|
||||
|
||||
type Rocketshipmaker {
|
||||
name: String
|
||||
rocketships(sort: String, limit: Int, start: Int, where: JSON): [Rocketship]
|
||||
id: ID!
|
||||
created_at: DateTime!
|
||||
updated_at: DateTime!
|
||||
@ -413,7 +414,6 @@ type Rocketshipmaker {
|
||||
|
||||
input RocketshipmakerInput {
|
||||
name: String
|
||||
rocketships: [ID]
|
||||
}
|
||||
|
||||
input RoleInput {
|
||||
|
||||
@ -7,6 +7,7 @@ import {
|
||||
GET_LAYOUT_SUCCEEDED,
|
||||
ON_CHANGE_LIST_LABELS,
|
||||
RESET_LIST_LABELS,
|
||||
RESET_PROPS,
|
||||
} from './constants';
|
||||
|
||||
export function deleteLayout(uid) {
|
||||
@ -67,3 +68,9 @@ export function resetListLabels(slug) {
|
||||
slug,
|
||||
};
|
||||
}
|
||||
|
||||
export function resetProps() {
|
||||
return {
|
||||
type: RESET_PROPS,
|
||||
};
|
||||
}
|
||||
|
||||
@ -7,3 +7,4 @@ export const GET_LAYOUT_SUCCEEDED = 'ContentManager/Main/GET_LAYOUT_SUCCEEDED';
|
||||
export const ON_CHANGE_LIST_LABELS =
|
||||
'ContentManager/Main/ON_CHANGE_LIST_LABELS';
|
||||
export const RESET_LIST_LABELS = 'ContentManager/Main/RESET_LIST_LABELS';
|
||||
export const RESET_PROPS = 'ContentManager/Main/RESET_PROPS';
|
||||
|
||||
@ -16,7 +16,7 @@ import SettingViewModel from '../SettingViewModel';
|
||||
import SettingViewGroup from '../SettingViewGroup';
|
||||
import SettingsView from '../SettingsView';
|
||||
|
||||
import { getData, getLayout } from './actions';
|
||||
import { getData, getLayout, resetProps } from './actions';
|
||||
import reducer from './reducer';
|
||||
import saga from './saga';
|
||||
import makeSelectMain from './selectors';
|
||||
@ -33,6 +33,7 @@ function Main({
|
||||
location: { pathname, search },
|
||||
global: { plugins },
|
||||
models,
|
||||
resetProps,
|
||||
}) {
|
||||
strapi.useInjectReducer({ key: 'main', reducer, pluginId });
|
||||
strapi.useInjectSaga({ key: 'main', saga, pluginId });
|
||||
@ -40,15 +41,21 @@ function Main({
|
||||
const source = getQueryParameters(search, 'source');
|
||||
const getDataRef = useRef();
|
||||
const getLayoutRef = useRef();
|
||||
const resetPropsRef = useRef();
|
||||
|
||||
getDataRef.current = getData;
|
||||
getLayoutRef.current = getLayout;
|
||||
resetPropsRef.current = resetProps;
|
||||
|
||||
const shouldShowLoader =
|
||||
slug !== 'ctm-configurations' && layouts[slug] === undefined;
|
||||
|
||||
useEffect(() => {
|
||||
getDataRef.current();
|
||||
|
||||
return () => {
|
||||
resetPropsRef.current();
|
||||
};
|
||||
}, [getDataRef]);
|
||||
useEffect(() => {
|
||||
if (shouldShowLoader) {
|
||||
@ -118,6 +125,7 @@ Main.propTypes = {
|
||||
search: PropTypes.string,
|
||||
}),
|
||||
models: PropTypes.array.isRequired,
|
||||
resetProps: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
const mapStateToProps = makeSelectMain();
|
||||
@ -127,6 +135,7 @@ export function mapDispatchToProps(dispatch) {
|
||||
{
|
||||
getData,
|
||||
getLayout,
|
||||
resetProps,
|
||||
},
|
||||
dispatch
|
||||
);
|
||||
|
||||
@ -11,6 +11,7 @@ import {
|
||||
GET_LAYOUT_SUCCEEDED,
|
||||
ON_CHANGE_LIST_LABELS,
|
||||
RESET_LIST_LABELS,
|
||||
RESET_PROPS,
|
||||
} from './constants';
|
||||
|
||||
export const initialState = fromJS({
|
||||
@ -58,6 +59,8 @@ function mainReducer(state = initialState, action) {
|
||||
return state.updateIn(['layouts', action.slug], () =>
|
||||
state.getIn(['initialLayouts', action.slug])
|
||||
);
|
||||
case RESET_PROPS:
|
||||
return initialState;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -129,7 +129,6 @@ function SettingViewModel({
|
||||
}, [modifiedData]);
|
||||
|
||||
// Retrieve the metadatas for the field's form of the edit view
|
||||
// Doesn't need to be a function
|
||||
const getSelectedItemMetas = useCallback(() => {
|
||||
return get(modifiedData, ['metadatas', itemNameToSelect, 'edit'], null);
|
||||
}, [modifiedData, itemNameToSelect]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user