-
Notifications
You must be signed in to change notification settings - Fork 24
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
Non editable list groups #85
Conversation
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.
👋
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.
Two small comments for understanding.
@@ -39,7 +39,8 @@ const DEFAULT_LAYOUT = { | |||
* component: import('preact').Component, | |||
* id: String, |
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.
Meta comment, just because I came across it: Plain types are supposed to be lower case, i.e. string
, number
, boolean
. Otherwise we refer to actual instances of String
(new String("FOO")
) which is not desired for type hints.
@@ -87,14 +88,14 @@ export default function ListGroup(props) { | |||
useEffect(() => { | |||
|
|||
// we already sorted as items were added | |||
if (open && !newItemAdded) { | |||
if (shouldSort && open && !newItemAdded) { |
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.
Can shouldSort
change? If so we'd need to make it part of the effect, right?
setOrdering(createOrdering(sortItems(items))); | ||
} | ||
}, [ open ]); | ||
|
||
// (3) items were deleted | ||
useEffect(() => { | ||
if (prevItems && items.length < prevItems.length) { | ||
if (shouldSort && prevItems && items.length < prevItems.length) { |
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.
See above: Can shouldSort
change?
@@ -39,7 +39,8 @@ const DEFAULT_LAYOUT = { | |||
* component: import('preact').Component, | |||
* id: String, | |||
* items: Array<ListItemDefinition>, | |||
* label: String | |||
* label: String, | |||
* shouldSort?: Boolean |
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.
Any reason to not simply call it sort
?
This makes it possible to have lists non-editable, which includes
Required by bpmn-io/bpmn-properties-panel#25