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: type error when sample has no collection tag data on saving sample #2158

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions app/packs/src/apps/mydb/elements/details/samples/SampleDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,15 +446,7 @@ export default class SampleDetails extends React.Component {
}

/* eslint-disable camelcase */
matchSelectedCollection(currentCollection) {
const { sample } = this.props;
if (sample.isNew) {
return true;
}
const { collection_labels } = sample.tag?.taggable_data || [];
const result = collection_labels.filter((object) => object.id === currentCollection.id).length > 0;
return result;
}


sampleFooter() {
const { sample, startExport } = this.state;
Expand Down Expand Up @@ -515,6 +507,16 @@ export default class SampleDetails extends React.Component {
this.setState({ isChemicalEdited: boolean });
};

matchSelectedCollection(currentCollection) {
const { sample } = this.props;
if (sample.isNew) {
return true;
}
const collection_labels = sample.tag?.taggable_data?.collection_labels || [];
const result = collection_labels.filter((object) => object.id === currentCollection.id).length > 0;
return result;
}

sampleInventoryTab(ind) {
const sample = this.state.sample || {};
const { saveInventoryAction } = this.state;
Expand Down
Loading