Skip to content

Commit d974f99

Browse files
MadinventorZerojonocrbuddhajjigaexkevinparkwilliamdyoon
committed
Fixed issues with keys and improper attribute names causing errors after each action.
Co-authored-by: jonocr <[email protected]> Co-authored-by: buddhajjigae <[email protected]> Co-authored-by: xkevinpark <[email protected]> Co-authored-by: williamdyoon <[email protected]>
1 parent 2c4658e commit d974f99

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

app/src/components/bottom/BottomTabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const BottomTabs = () => {
4040
setTheme(e.target.value);
4141
};
4242

43-
console.log("Editor Theme: ", theme);
43+
// console.log("Editor Theme: ", theme);
4444

4545
return (
4646
<div className={classes.root} style={style}>

app/src/components/form/Selector.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import MenuItem from '@material-ui/core/MenuItem';
66

77
const FormSelector = (props): JSX.Element => {
88
const items = [];
9+
let key = 1;
910
props.items.forEach(el => {
10-
items.push(<MenuItem value={el.value}>{el.text}</MenuItem>);
11+
items.push(<MenuItem value={el.value} key={`menu${key}`}>{el.text}</MenuItem>);
12+
key++
1113
})
1214
return (
1315
<div className={props.classes.configRow}>

app/src/components/right/ComponentPanel.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,13 @@ const ComponentPanel = ({isThemeLight}): JSX.Element => {
148148
color={'primary'}
149149
variant="outlined"
150150
className={isThemeLight ? `${classes.inputField} ${classes.lightThemeFontColor}` : `${classes.inputField} ${classes.darkThemeFontColor}`}
151-
InputProps={{ className: classes.input }}
151+
// Caret inputprops and helpertext must be lowercase
152+
inputprops={{ className: classes.input }}
152153
value={compName}
153-
error={errorStatus}
154-
helperText={errorStatus ? errorMsg : ''}
154+
// Doesn't accept boolean value needs to be a string
155+
error={errorStatus.toString()}
156+
// Updated
157+
helpertext={errorStatus ? errorMsg : ''}
155158
onChange={handleNameInput}
156159
/>
157160
</div>

app/src/helperFunctions/renderChildren.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ const renderChildren = (children: ChildElement[]) => {
1818
if (name === '') child.name = state.components[typeId - 1].name;
1919
// A DirectChildComponent is an instance of a top level component
2020
// This component will render IndirectChild components (div/components rendered inside a child component)
21-
// Caret Start Removed style from prop drills so that styling isn't applied to canvas items
21+
// Caret Start Removed style from prop drills so that styling isn't applied to canvas items.
22+
// Also added keys & removed an unnecessary div around DirChildNestables that were causing errors.
2223
if (type === 'Component') {
2324
return (
2425
<DirectChildComponent
2526
childId={childId}
2627
type={type}
2728
typeId={typeId}
28-
key={'DirChildComp' + childId.toString() + name}
29+
key={'DirChildComp' + childId.toString() + name + (Math.random()*1000).toString()}
2930
name={name}
3031
annotations={annotations}
3132
/>
@@ -39,7 +40,7 @@ const renderChildren = (children: ChildElement[]) => {
3940
childId={childId}
4041
type={type}
4142
typeId={typeId}
42-
key={'DirChildHTML' + childId.toString() + name}
43+
key={'DirChildHTML' + childId.toString() + name + (Math.random()*1000).toString()}
4344
name={name}
4445
annotations={annotations}
4546
/>
@@ -48,17 +49,16 @@ const renderChildren = (children: ChildElement[]) => {
4849
// Caret Added Orderedlists, Unorderedlists, and Menus, changed lists to nestable because they are nestable.
4950
// child is a nestable type of HTML element (divs and forms)
5051
else if (type === 'HTML Element' && (typeId === 11 || typeId === 2 || typeId === 3 || typeId === 14 || typeId === 15 || typeId === 16)) {
51-
return ( <div>
52+
return (
5253
<DirectChildHTMLNestable
5354
childId={childId}
5455
type={type}
5556
typeId={typeId}
5657
children={children}
57-
key={'DirChildHTMLNest' + childId.toString() + name}
58+
key={'DirChildHTMLNest' + childId.toString() + name + (Math.random()*1000).toString()}
5859
name={name}
5960
annotations={annotations}
6061
/>
61-
</div>
6262
);
6363
}
6464
else if (type === 'HTML Element' && typeId === 1000 ) {
@@ -68,7 +68,7 @@ const renderChildren = (children: ChildElement[]) => {
6868
type={type}
6969
typeId={typeId}
7070
children={children}
71-
key={'DirChildHTMLNest' + childId.toString() + name}
71+
key={'SeparatorChild' + childId.toString() + name + (Math.random()*1000).toString()}
7272
name={name}
7373
/>
7474
);
@@ -82,7 +82,7 @@ const renderChildren = (children: ChildElement[]) => {
8282
type={type}
8383
typeId={typeId}
8484
children={children}
85-
key={'RouteLink' + childId.toString() + name}
85+
key={'RouteLink' + childId.toString() + name + (Math.random()*1000).toString()}
8686
name={name}
8787
/>
8888
);

0 commit comments

Comments
 (0)