-
Notifications
You must be signed in to change notification settings - Fork 16
fix(dynamic-form): change example from textarea to code-editor #3199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
textarea { | ||
limel-code-editor { | ||
width: 100%; | ||
min-height: 300px; | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the commit type is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let me know if you want help changing the title 😊 |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -45,7 +45,14 @@ export class DynamicFormExample { | |||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public render() { | ||||||||||||||||||||||||||||||||||||
return [ | ||||||||||||||||||||||||||||||||||||
<textarea onChange={this.handleTextChange}>{this.text}</textarea>, | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in the previous version, one could typ inside the textarea and see the results live in the form below. We should make sure that the same thing happens when using the code-editor |
||||||||||||||||||||||||||||||||||||
<limel-code-editor | ||||||||||||||||||||||||||||||||||||
language="json" | ||||||||||||||||||||||||||||||||||||
lineNumbers={true} | ||||||||||||||||||||||||||||||||||||
lint={true} | ||||||||||||||||||||||||||||||||||||
fold={true} | ||||||||||||||||||||||||||||||||||||
onChange={this.handleTextChange} | ||||||||||||||||||||||||||||||||||||
value={this.text} | ||||||||||||||||||||||||||||||||||||
/>, | ||||||||||||||||||||||||||||||||||||
Comment on lines
+48
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add key prop to elements in the render array Each element in an array should have a unique "key" prop to help React efficiently update the DOM. <limel-code-editor
+ key="editor"
language="json"
lineNumbers={true}
lint={true}
fold={true}
onChange={this.handleTextChange}
value={this.text}
/>, This applies to all elements in the returned array. The static analysis tool correctly flagged this issue. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (1.9.4)[error] 48-55: Missing key property for this element in iterable. The order of the items may change, and having a key can help React identify which item was moved. (lint/correctness/useJsxKeyInIterable) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha, funny. In the first review, Biome detected this, but CodeRabbit suppressed it as a false positive, because the array is never modified. This time around, it instead expressed that "The static analysis tool correctly flagged this issue." 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adrianschmidt You caught me! That's definitely an inconsistency on my part. You're right - the array is static and never reordered, so while React technically recommends keys for all array elements, it's much less critical in this scenario. The first review had the more appropriate assessment. I'll make sure to be more consistent about this specific linting rule going forward. Thanks for pointing this out! 😄 ✏️ Learnings added
|
||||||||||||||||||||||||||||||||||||
<br />, | ||||||||||||||||||||||||||||||||||||
<limel-form | ||||||||||||||||||||||||||||||||||||
onChange={this.handleFormChange} | ||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.