set all copyapble keys to true by default

This commit is contained in:
Ed Chalstrey 2022-06-23 10:38:22 +01:00
parent 42aa1f6ed0
commit 56db0c58df

View File

@ -81,11 +81,15 @@ const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContaine
static getDerivedStateFromProps(props, state): DataContainerState {
const newBuildingId = props.building == undefined ? undefined : props.building.building_id;
const newBuildingRevisionId = props.building == undefined ? undefined : props.building.revision_id;
const categoryKeys = {};
for (let key in myDictionary) {
categoryKeys[key] = true;
}
if(newBuildingId !== state.currentBuildingId || newBuildingRevisionId > state.currentBuildingRevisionId) {
return {
error: undefined,
copying: false,
keys_to_copy: {},
keys_to_copy: categoryKeys,
buildingEdits: {},
currentBuildingId: newBuildingId,
currentBuildingRevisionId: newBuildingRevisionId