Skip to content

Commit

Permalink
Merge pull request #563 from components-ai/maintain-props
Browse files Browse the repository at this point in the history
Keep props around when swapping between components
  • Loading branch information
johno authored Aug 15, 2022
2 parents 9277d2d + 9628acc commit e478f4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dull-keys-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@compai/css-gui': patch
---

Keep props around when swapping between components
3 changes: 2 additions & 1 deletion packages/gui/src/components/html/Component/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export const ComponentEditor = ({ value, onChange }: ComponentEditorProps) => {

const handleComponentSelected = (selectedItem: string) => {
const component = components.find((c) => c.id === selectedItem)

if (component) {
onChange(component)
onChange({ ...component, props: value.props })
}
}

Expand Down

1 comment on commit e478f4b

@vercel
Copy link

@vercel vercel bot commented on e478f4b Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

css-gui – ./

css-gui-git-main-components-ai.vercel.app
css-gui-components-ai.vercel.app
css-gui.vercel.app

Please sign in to comment.