diff --git a/packages/xod-client/src/project/reducer.js b/packages/xod-client/src/project/reducer.js index 601bf2652..48fd58b1b 100644 --- a/packages/xod-client/src/project/reducer.js +++ b/packages/xod-client/src/project/reducer.js @@ -94,19 +94,17 @@ export default (state = {}, action) => { // Project // case AT.PROJECT_CREATE: { - const oldLocalPatchesPaths = R.compose( - R.map(XP.getPatchPath), - XP.listLocalPatches + const libraryPatches = R.compose( + // TODO: change it to 'isGenuine' check when is is merged + R.reject(R.pipe(XP.getPatchPath, XP.isBuiltInLibName)), + 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: {