Skip to content

Commit

Permalink
fix: labeling doesn't work via shortcuts on the new project or empty …
Browse files Browse the repository at this point in the history
…tags (#677)
  • Loading branch information
alex-krasn authored Nov 9, 2020
1 parent 25eb59b commit f112919
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/react/components/common/tagInput/tagInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ export class TagInput extends React.Component<ITagInputProps, ITagInputState> {
}
}
public labelAssigned = (labels: ILabel[], name): boolean => {
const label = labels.find((label) => label.label === name ? true : false);
const label = labels?.find((label) => label.label === name ? true : false);
if (!label) {
return false;
} else {
Expand All @@ -589,7 +589,7 @@ export class TagInput extends React.Component<ITagInputProps, ITagInputState> {
}

public labelAssignedDrawnRegion = (labels: ILabel[], name): boolean => {
const label = labels.find((label) => label.label === name ? true : false);
const label = labels?.find((label) => label.label === name ? true : false);
if (label?.labelType === FeatureCategory.DrawnRegion) {
return true;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/react/components/pages/editorPage/editorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export default class EditorPage extends React.Component<IEditorPageProps, IEdito
const { format, type, documentCount, name } = tag;
const tagCategory = this.tagInputRef.current.getTagCategory(tag.type);
const category = selection[0].category;
const labels = this.state.selectedAsset.labelData.labels;
const labels = this.state.selectedAsset.labelData?.labels;
const isTagLabelTypeDrawnRegion = this.tagInputRef.current.labelAssignedDrawnRegion(labels, tag.name);
const labelAssigned = this.tagInputRef.current.labelAssigned(labels, name);

Expand Down

0 comments on commit f112919

Please sign in to comment.