fix(measurement-tracking): restore tracked state on undo after Delete all (#5994)

* fix: always show delete confirmation when measurements exist
This commit is contained in:
Ghadeer Albattarni authored and GitHub committed 2026-05-12 13:22:25 -04:00
1 parent 8cd8ccc163
commit 397aa4d0e3
10 files changed
+238 -30

No files matched your search

@@ -499,7 +499,7 @@ class MeasurementService extends PubSubService {
mapping => mapping.annotationType === annotationType
);
if (!sourceMapping) {
if (!sourceMissing.has(source.uid) ) {
if (!sourceMissing.has(source.uid)) {
console.log('No source mapping', source.uid, annotationType, source);
sourceMissing.add(source.uid);
}
@@ -716,12 +716,12 @@ class MeasurementService extends PubSubService {
* That allows, for example, clearing all of a single studies measurements
* without needing to clear other measurements.
*/
public clearMeasurements(filter?: MeasurementFilter) {
public clearMeasurements(filter?: MeasurementFilter, metadata?: Record<string, unknown>) {
// Make a copy of the measurements
const toClear = this.getMeasurements(filter);
const measurements = [...toClear];
toClear.forEach(measurement => this.measurements.delete(measurement.uid));
this._broadcastEvent(this.EVENTS.MEASUREMENTS_CLEARED, { measurements });
this._broadcastEvent(this.EVENTS.MEASUREMENTS_CLEARED, { measurements, ...metadata });
}
/**