Skip to content

Commit

Permalink
refactor: handle case where preview state updates before data
Browse files Browse the repository at this point in the history
Might be able to refactor this once all state moves to zustand.
  • Loading branch information
chrisvxd committed Jan 13, 2025
1 parent 63b8b9a commit 01d9695
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/core/components/DropZone/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,13 @@ const DropZoneEdit = forwardRef<HTMLDivElement, DropZoneProps>(

let label = componentConfig?.["label"] ?? item.type.toString();

if (item.type === "preview" && preview) {
componentType = preview.componentType;
if (item.type === "preview") {
componentType = preview?.componentType ?? "__preview";

label =
config.components[componentType]?.label ?? preview.componentType;
config.components[componentType]?.label ??
componentType ??
"Preview";

function Preview() {
return (
Expand Down

0 comments on commit 01d9695

Please sign in to comment.