Skip to content

Commit 22b5887

Browse files
committed
update code preview when switching components
1 parent b5d098b commit 22b5887

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/src/reducers/componentReducer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ const reducer = (state: State, action: Action) => {
395395
if (childId < 1000) {
396396
// makes separators not selectable
397397
const canvasFocus = { ...state.canvasFocus, componentId, childId };
398-
return { ...state, canvasFocus };
398+
//makes it so the code preview will update when clicking on a new component
399+
const components = state.components.map(element => {
400+
return Object.assign({}, element);
401+
});
402+
return { ...state, components, canvasFocus };
399403
}
400404
return { ...state };
401405
}

0 commit comments

Comments
 (0)