tweak(xod-client): reset metadata when creating new project

This commit is contained in:
Evgeny Kochetkov
2018-05-28 20:44:31 +03:00
parent c3808cbe8d
commit 85b13ae4cd
2 changed files with 8 additions and 10 deletions

View File

@@ -94,19 +94,16 @@ export default (state = {}, action) => {
// Project
//
case AT.PROJECT_CREATE: {
const oldLocalPatchesPaths = R.compose(
R.map(XP.getPatchPath),
XP.listLocalPatches
const libraryPatches = R.compose(
R.filter(XP.isGenuinePatch),
XP.listLibraryPatches
)(state);
const mainPatch = XP.createPatch();
const mainPatch = XP.setPatchPath(MAIN_PATCH_PATH, XP.createPatch());
return R.compose(
explodeEither,
XP.assocPatch(MAIN_PATCH_PATH, mainPatch),
XP.setProjectName(''),
XP.omitPatches(oldLocalPatchesPaths)
)(state);
const newProject = XP.createProject();
return XP.mergePatchesList([mainPatch, ...libraryPatches], newProject);
}
case AT.PROJECT_IMPORT: {

View File

@@ -58,6 +58,7 @@ export {
getArityStepFromPatch,
isVariadicPatch,
isAbstractPatch,
isGenuinePatch,
isPatchNotImplementedInXod,
doesPatchHaveGenericPins,
validateAbstractPatch,