Skip to content

Commit

Permalink
fix replace in number leave import in middle (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik authored Sep 11, 2024
2 parents db15191 + 121d395 commit 4922a42
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
22 changes: 17 additions & 5 deletions apps/api/src/app/review/usecases/replace/replace.usecase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,23 @@ export class Replace {
},
};
replaceOperation = {
$toDouble: {
$replaceAll: {
input: { $toString: '$' + path },
find: find,
replacement: replace,
$cond: {
if: { $eq: [formattedReplace, ''] },
then: null,
else: {
$cond: {
if: { $eq: [{ $type: '$' + path }, 'number'] },
then: {
$toDouble: {
$replaceAll: {
input: { $toString: '$' + path },
find: find,
replacement: formattedReplace,
},
},
},
else: formattedReplace,
},
},
},
};
Expand Down
13 changes: 8 additions & 5 deletions apps/widget/src/components/widget/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,18 @@ export function Widget() {
setPromptContinueAction(undefined);
};
const onClose = () => {
if (
[
let isImportNotOnProgress = false;
if (importConfig.mode === TemplateModeEnum.AUTOMATIC)
isImportNotOnProgress = [PhasesEnum.CONFIGURE, PhasesEnum.CONFIRM].includes(phase);
else
isImportNotOnProgress = [
PhasesEnum.VALIDATE,
PhasesEnum.IMAGE_UPLOAD,
PhasesEnum.UPLOAD,
PhasesEnum.COMPLETE,
PhasesEnum.CONFIRM,
].includes(phase)
) {
].includes(phase);

if (isImportNotOnProgress) {
setPhase(PhasesEnum.VALIDATE);
resetAppState();
closeWidget();
Expand Down

0 comments on commit 4922a42

Please sign in to comment.