Skip to content

Commit b0aeaaa

Browse files
fix[reactSdk][gen1]: ENG-7900 Dynamic Symbol in Visual Editor loads the wrong Symbol type (BuilderIO#3829)
## Description - When 2 or more dynamic symbols are used in a content, it was showing the same preview for all the symbols on initial load in the content editor - For dynamic symbols we were passing the React key as `undefined` hence on initial render all the symbol blocks had the same key, now we are setting the key as the block id. - This issue is only on the gen 1 react sdk. **Jira Ticket** https://builder-io.atlassian.net/browse/ENG-7900 **Loom** https://www.loom.com/share/831e4bc4816845269769b323b5696765 --------- Co-authored-by: Sami Jaber <[email protected]>
1 parent 750082f commit b0aeaaa

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@builder.io/react": patch
3+
---
4+
5+
Fix: Dynamic symbols not rendering properly in Visual Editor.

packages/react/src/blocks/Symbol.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class SymbolComponent extends React.Component<PropsWithChildren<SymbolProps>> {
112112
showPlaceholder = false;
113113
}
114114

115-
let key = dynamic ? undefined : [model, entry].join(':');
115+
let key = dynamic ? this.props.builderBlock?.id : [model, entry].join(':');
116116
const dataString = data && size(data) && hash(data);
117117

118118
if (key && dataString && dataString.length < 300) {

0 commit comments

Comments
 (0)