refactor: remove useless params in setValue method

This commit is contained in:
QiShaoXuan
2022-08-03 19:21:30 +08:00
parent c347878f23
commit 503752ce00
3 changed files with 12 additions and 26 deletions

View File

@@ -92,8 +92,7 @@ export const useOnCreateSure = ({ block }: { block: AsyncBlock }) => {
type: newProperty.type, type: newProperty.type,
value: selectedId, value: selectedId,
} as SelectValue | MultiSelectValue | StatusValue, } as SelectValue | MultiSelectValue | StatusValue,
recastBlock.id, recastBlock.id
newProperty.id
); );
} else if (type === PendantTypes.Information) { } else if (type === PendantTypes.Information) {
const emailOptions = genOptionWithId(newPropertyItem.emailOptions); const emailOptions = genOptionWithId(newPropertyItem.emailOptions);
@@ -137,8 +136,7 @@ export const useOnCreateSure = ({ block }: { block: AsyncBlock }) => {
}), }),
}, },
} as InformationValue, } as InformationValue,
recastBlock.id, recastBlock.id
newProperty.id
); );
} else { } else {
// TODO: Color and background should use pendant config, but ui is not design now // TODO: Color and background should use pendant config, but ui is not design now
@@ -158,8 +156,7 @@ export const useOnCreateSure = ({ block }: { block: AsyncBlock }) => {
type: newProperty.type, type: newProperty.type,
value: newValue, value: newValue,
} as TextValue | DateValue, } as TextValue | DateValue,
recastBlock.id, recastBlock.id
newProperty.id
); );
} }
}; };
@@ -236,8 +233,7 @@ export const useOnUpdateSure = ({
type: selectProperty.type, type: selectProperty.type,
value: selectedId, value: selectedId,
} as SelectValue | MultiSelectValue | StatusValue, } as SelectValue | MultiSelectValue | StatusValue,
recastBlock.id, recastBlock.id
selectProperty.id
); );
} else if (type === PendantTypes.Information) { } else if (type === PendantTypes.Information) {
// const { emailOptions, phoneOptions, locationOptions } = // const { emailOptions, phoneOptions, locationOptions } =
@@ -295,8 +291,7 @@ export const useOnUpdateSure = ({
}), }),
}, },
} as InformationValue, } as InformationValue,
recastBlock.id, recastBlock.id
newProperty.id
); );
} else { } else {
await setValue( await setValue(
@@ -305,8 +300,7 @@ export const useOnUpdateSure = ({
type: property.type, type: property.type,
value: newValue, value: newValue,
} as TextValue | DateValue, } as TextValue | DateValue,
recastBlock.id, recastBlock.id
property.id
); );
} }

View File

@@ -131,8 +131,7 @@ export const moveCardToGroup = async ({
type: group.type, type: group.type,
value: group.id, value: group.id,
}, },
recastBlock.id, recastBlock.id
groupBy.id
); );
break; break;
} }
@@ -143,8 +142,7 @@ export const moveCardToGroup = async ({
type: group.type, type: group.type,
value: group.id, value: group.id,
}, },
recastBlock.id, recastBlock.id
groupBy.id
); );
break; break;
} }
@@ -155,8 +153,7 @@ export const moveCardToGroup = async ({
type: group.type, type: group.type,
value: [group.id], value: [group.id],
}, },
recastBlock.id, recastBlock.id
groupBy.id
); );
break; break;
} }
@@ -167,8 +164,7 @@ export const moveCardToGroup = async ({
type: group.type, type: group.type,
value: group.id, value: group.id,
}, },
recastBlock.id, recastBlock.id
groupBy.id
); );
break; break;
} }

View File

@@ -241,15 +241,11 @@ export const getRecastItemValue = (block: RecastItem | AsyncBlock) => {
return props[id]; return props[id];
}; };
const setValue = ( const setValue = (newValue: RecastBlockValue, recastBlockId: string) => {
newValue: RecastBlockValue,
recastBlockId: string,
propertyId: RecastPropertyId
) => {
setHistory({ setHistory({
recastBlockId: recastBlockId, recastBlockId: recastBlockId,
blockId: block.id, blockId: block.id,
propertyId: propertyId, propertyId: newValue.id,
}); });
return recastItem.setProperty(TABLE_VALUES_KEY, { return recastItem.setProperty(TABLE_VALUES_KEY, {