Skip to content

Commit

Permalink
Fixes #47
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecmart committed Feb 5, 2024
1 parent db0b4d9 commit 38233d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 6 additions & 1 deletion packages/protoflow/src/FlowBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,13 @@ const FlowsBase = ({
var parentId
var nodeId = payload.nodeId
var param = payload.param
var value = payload.value
var topicParams
var value = payload.value

try {
value = JSON.parse(value)
} catch (e) { }

switch (action) {
case 'delete-node':
const deletedNodes = payload
Expand Down
9 changes: 3 additions & 6 deletions packages/visualui/src/components/EditorLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const Editor = ({ children, topics, currentPageContent, resolveComponentsDir, on
action: 'edit-node',
nodeId: nodeId,
newChildValue: newChildValue,
debounce: true
debounce: true
}
} else if (movedParent_diff) { // moved changing parent
const nodeId_moved = movedParent_diff.path[0];
Expand Down Expand Up @@ -130,6 +130,7 @@ const Editor = ({ children, topics, currentPageContent, resolveComponentsDir, on
const nodeId = flowData.nodeId;
const value = flowData.value;
const modifiedKey = flowData.param;

switch (action) {
case 'delete-node':
if (flowData.deletedNodeType != "JsxElement") return
Expand All @@ -154,11 +155,7 @@ const Editor = ({ children, topics, currentPageContent, resolveComponentsDir, on
if (!modifiedKey) return
try {
actions.setOptions(options => options['skipTopic'] = true)
let val = value;
try {
val = JSON.parse(val)
} catch (e) { }
actions.setProp(nodeId, (props) => props[modifiedKey] = val)
actions.setProp(nodeId, (props) => props[modifiedKey] = value)
actions.setCustom(nodeId, (custom) => custom[modifiedKey] = "JsxText")
const deleteKey = flowData?.deleteKey
if (deleteKey) {
Expand Down

0 comments on commit 38233d8

Please sign in to comment.