Skip to content

Commit

Permalink
- KBDEV-1249
Browse files Browse the repository at this point in the history
- Add check if variant has positional information before transforming refSeq and refAA for protein position
- Undo ternary operator for api response for variant creation/update to get result data for snackbar and redirecting to variant view
  • Loading branch information
bnguyen-bcgsc committed Sep 11, 2024
1 parent d00937c commit 5eccf6b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/VariantForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const VariantForm = ({

/* KBDEV-1216 Adding refAA to break1Start property when new variant has ProteinPosition coordinate system.
Property has the same value as refSeq and should be hidden from users to avoid confusion. */
if (payload?.break1Start['@class'] === 'ProteinPosition') {
if (payload?.break1Start && payload?.break1Start['@class'] === 'ProteinPosition') {
const refAA = payload.refSeq ? payload.refSeq : '';
payload.break1Start = { ...payload.break1Start, refAA };
}
Expand All @@ -167,10 +167,12 @@ const VariantForm = ({
: 'edited';

try {
const result = await formVariant === FORM_VARIANT.NEW
? api.post(routeName, payload)
: api.patch(`${routeName}/${content['@rid'].replace(/^#/, '')}`, payload);

let result;
if (formVariant === FORM_VARIANT.NEW) {

Check failure on line 171 in src/components/VariantForm/index.tsx

View workflow job for this annotation

GitHub Actions / build

Expected blank line before this statement
result = await api.post(routeName, payload);
} else {
result = await api.patch(`${routeName}/${content['@rid'].replace(/^#/, '')}`, payload);
}
snackbar.enqueueSnackbar(`Sucessfully ${actionType} the record ${result['@rid']}`, { variant: 'success' });
onSubmit(result);
} catch (err) {
Expand Down

0 comments on commit 5eccf6b

Please sign in to comment.