Skip to content

Commit

Permalink
tweak(xod-client): reset metadata when creating new project
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenykochetkov committed May 28, 2018
1 parent 85360d9 commit 9405f9d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/xod-client/src/project/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 9405f9d

Please sign in to comment.