Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Allow empty Source Component on flaws in NEW state (`OSIDB-5273`)
* Make workflow, product_family and alias labels non-editable (`OSIDB-5385`)
* Fix strikethrough incorrectly applied to labels without relevant field (`OSIDB-5375`)
* Do not update affects from Flaw PUT response (OSIDB-5297)

## [2026.8.0-patch-missing-labels]
### Fixed
Expand Down
24 changes: 24 additions & 0 deletions src/composables/__tests__/useFlawModel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@ describe('useFlawModel', () => {
expect(putFlaw).not.toHaveBeenCalled();
});

it('should not apply affects from the putFlaw response', async () => {
const { flaw, setFlaw } = useFlaw();
const flawData = deepCopyFromRaw(sampleFlawFull as ZodFlawType);
const localAffects = [{ ...flawData.affects[0], uuid: 'local-affect' }];
flawData.affects = localAffects;
setFlaw(flawData);

vi.mocked(putFlaw).mockResolvedValue({
...flawData,
title: 'from-put',
affects: [{ ...flawData.affects[0], uuid: 'stale-from-put' }],
});

const { updateFlaw } = mountFlawModel();
flaw.value.title = 'altered';
await flushPromises();
await updateFlaw();
await flushPromises();

expect(putFlaw).toHaveBeenCalled();
expect(flaw.value.title).toBe('from-put');
expect(flaw.value.affects).toEqual(localAffects);
});

it('should call postFlaw on createFlaw', () => {
const { flaw } = useFlaw();
flaw.value = sampleFlawRequired as ZodFlawType;
Expand Down
5 changes: 4 additions & 1 deletion src/composables/useFlawModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ export function useFlawModel() {
...validatedFlaw.data,
...getAegisMetadataIfChanged(),
}, shouldCreateJiraTask.value);
afterSuccessQueue.push(() => setFlaw(response));
afterSuccessQueue.push(() => setFlaw({
...response,
affects: flaw.value.affects,
}));
},
);
}
Expand Down
Loading