From 9027601944a7cb1c14e4a94de4efba1f1690c0b8 Mon Sep 17 00:00:00 2001 From: Evgeny Kochetkov Date: Wed, 17 Jan 2018 13:26:52 +0300 Subject: [PATCH] fix(xod-client): attach an implementation when adding `not-implemented-in-xod` node Closes #998 --- packages/xod-client/src/project/reducer.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/xod-client/src/project/reducer.js b/packages/xod-client/src/project/reducer.js index d3a2a5fc..f59fe490 100644 --- a/packages/xod-client/src/project/reducer.js +++ b/packages/xod-client/src/project/reducer.js @@ -5,6 +5,7 @@ import { getLibName } from 'xod-pm'; import * as AT from './actionTypes'; import { PASTE_ENTITIES, INSTALL_LIBRARIES_COMPLETE } from '../editor/actionTypes'; +import { IMPL_TEMPLATE } from '../editor/constants'; import { addPoints, @@ -278,7 +279,16 @@ export default (state = {}, action) => { return R.over( XP.lensPatch(patchPath), // TODO: can we have a situation where patch does not exist? - XP.assocNode(newNode), + R.compose( + XP.assocNode(newNode), + R.when( + R.both( + () => typeId === XP.NOT_IMPLEMENTED_IN_XOD_PATH, + R.complement(XP.hasImpl) + ), + XP.setImpl(IMPL_TEMPLATE) + ) + ), state ); }