Skip to content
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

Merged
merged 5 commits into from
Apr 6, 2023
Merged

fix: EntitySelect #1215

merged 5 commits into from
Apr 6, 2023

Conversation

jczhong84
Copy link
Collaborator

forgot to check validateEntity could be null

@@ -64,8 +67,8 @@ export const EntitySelect = ({
() =>
!searchText ||
(!selectedEntities.includes(searchText) &&
validateEntity(searchText)),
[searchText, selectedEntities, validateEntity]
(!creatable || !validateEntity || validateEntity(searchText))),
Copy link
Collaborator

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
Copy link
Collaborator

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'}>
Copy link
Collaborator

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

@jczhong84 jczhong84 merged commit c141948 into pinterest:master Apr 6, 2023
@jczhong84 jczhong84 deleted the fix/es branch April 7, 2023 00:40
rohan-sh1 pushed a commit to CAI-TECHNOLOGIES/cai-ext-db-explorer that referenced this pull request Apr 11, 2023
* fix: EntitySelect

* check creatable

* comments

* comments

* fix undefined
aidenprice pushed a commit to arrowtail-precision/querybook that referenced this pull request Jan 3, 2024
* fix: EntitySelect

* check creatable

* comments

* comments

* fix undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants