Skip to content

Commit

Permalink
Fix: Fix a loading caselibrary bug (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
jane-rose authored Nov 13, 2020
1 parent 6da1e5b commit b254bbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/app/widgets/CaseLibrary/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CaseLibrary extends PureComponent {
// laser: PropTypes.object.isRequired,
insertDefaultCncTextVector: PropTypes.func.isRequired,
insertDefaultLaserTextVector: PropTypes.func.isRequired,
updateDefaultAdvised: PropTypes.func.isRequired,
updateIsRecommended: PropTypes.func.isRequired,
updateDefaultMaterialId: PropTypes.func.isRequired,
updateDefaultQualityId: PropTypes.func.isRequired,
qualityDefinitions: PropTypes.array.isRequired,
Expand Down Expand Up @@ -69,9 +69,9 @@ class CaseLibrary extends PureComponent {
const qualityDefinition = await this.props.qualityDefinitions.find(d => d.definitionId === qualityDefinitionId);
if (qualityDefinition) {
if (['quality.fast_print', 'quality.normal_quality', 'quality.high_quality'].indexOf(qualityDefinitionId) === -1) {
this.props.updateDefaultAdvised(false);
this.props.updateIsRecommended(false);
} else {
this.props.updateDefaultAdvised(true);
this.props.updateIsRecommended(true);
}
this.props.updateDefaultQualityId(qualityDefinitionId);
this.props.updateActiveDefinition(qualityDefinition);
Expand All @@ -88,7 +88,7 @@ class CaseLibrary extends PureComponent {
newDefinition.settings[key].from = addDefinition.definitionId;
}
}
this.props.updateDefaultAdvised(false);
this.props.updateIsRecommended(false);

this.props.updateDefinitionSettings(newDefinition, newDefinition.settings);
this.props.updateDefaultQualityId(newDefinition.definitionId);
Expand Down
2 changes: 1 addition & 1 deletion src/app/widgets/PrintingConfigurations/Configurations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class Configurations extends PureComponent {
}
},
onSetOfficialTab: (isRecommended) => {
if (isRecommended && /^quality.([0-9_]+)$/.test(this.props.defaultQualityId)) {
if (isRecommended && (/^quality.([0-9_]+)$/.test(this.props.defaultQualityId) || this.props.defaultQualityId.indexOf('Caselibrary') > -1)) {
this.props.updateDefaultQualityId('quality.fast_print');
}
this.props.updateIsRecommended(isRecommended);
Expand Down

0 comments on commit b254bbb

Please sign in to comment.