Skip to content

Commit

Permalink
fix(lb-components): Fix copy backwardResult issue about valid
Browse files Browse the repository at this point in the history
  • Loading branch information
lihqi committed Jun 24, 2024
1 parent a4f3630 commit 8a70418
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/lb-components/src/store/annotation/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,13 +736,15 @@ export const annotationReducer = (

const currentStepInfo = StepUtils.getCurrentStepInfo(step, stepList);
const copyStep = currentStepInfo?.step ?? step;
const valid = toolInstance?.valid ?? true;

const newResult = AnnotationDataUtils.copyResultChange({
copyResult: backwardResult,
step: copyStep,
currentResult: imgList[imgIndex].result ?? '',
preMappingImgList: imgList[imgIndex - 1].mappingImgList ?? [],
mappingImgList: imgList[imgIndex].mappingImgList ?? [],
valid,
});

imgList[imgIndex] = {
Expand Down
4 changes: 3 additions & 1 deletion packages/lb-components/src/utils/AnnotationDataUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface ICopyResultChangeParams {
currentResult: string;
mappingImgList: IMappingImg[];
preMappingImgList: IMappingImg[];
valid: boolean;
}

interface IGetNextPath {
Expand Down Expand Up @@ -123,11 +124,12 @@ export default class AnnotationDataUtils {
* @returns
*/
public static copyResultChange(params: ICopyResultChangeParams) {
const { copyResult, step, currentResult, mappingImgList, preMappingImgList } = params;
const { copyResult, step, currentResult, mappingImgList, preMappingImgList, valid } = params;
// 其实其限定的范围一般都在单图的情况
try {
const copyData = jsonParser(copyResult);
const currentData = jsonParser(currentResult);
currentData.valid = valid;
const stepName = `step_${step}`;
if (copyData[stepName]) {
// 这层可能还要处理 dataSource 依赖问题
Expand Down

0 comments on commit 8a70418

Please sign in to comment.