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 29, 2018
1 parent c3808cb commit 85b13ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
17 changes: 7 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,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: {
Expand Down
1 change: 1 addition & 0 deletions packages/xod-project/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export {
getArityStepFromPatch,
isVariadicPatch,
isAbstractPatch,
isGenuinePatch,
isPatchNotImplementedInXod,
doesPatchHaveGenericPins,
validateAbstractPatch,
Expand Down

0 comments on commit 85b13ae

Please sign in to comment.