-
Notifications
You must be signed in to change notification settings - Fork 237
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
fix: EntitySelect #1215
fix: EntitySelect #1215
Conversation
@@ -64,8 +67,8 @@ export const EntitySelect = ({ | |||
() => | |||
!searchText || | |||
(!selectedEntities.includes(searchText) && | |||
validateEntity(searchText)), | |||
[searchText, selectedEntities, validateEntity] | |||
(!creatable || !validateEntity || validateEntity(searchText))), |
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.
this is kind of hard to read:
const isValidForCreation = creatable && searchText.length > 0 && !selectedEntities.includes(searchText) && (
validateEntity?.(searchText) ?? true
)
@@ -20,7 +20,10 @@ interface IEntitySelectProps { | |||
placeholder?: string; | |||
onSelect?: (entity: string) => void; | |||
onEntitiesChange?: (entities: string[]) => void; | |||
|
|||
// will validate only if creatable is true |
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.
change this to
/**
*
*/
format so it can be include in jsdocs
@@ -104,7 +107,7 @@ export const EntitySelect = ({ | |||
))} | |||
</div> | |||
)} | |||
<div className={isValid ? undefined : 'invalid'}> | |||
<div className={isInvalidForCreation ? 'invalid' : 'undefined'}> |
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 is a quote in undefined
* fix: EntitySelect * check creatable * comments * comments * fix undefined
* fix: EntitySelect * check creatable * comments * comments * fix undefined
forgot to check
validateEntity
could be null