fix(grid):Grid service wasn't being reset (#3068)

* fix(grid):Grid service wasn't being reset

* fix(service):Fix the initial service state

Services with mode specific state differed in internal state between
initial and subsequent load.  This fix address that structurally by
allows the mode to store/manage service state, but makes the
responsibility of service state central to the service.
This commit is contained in:
Bill Wallace authored and GitHub committed 2022-12-09 10:58:01 -05:00
1 parent 42dca11ae3
commit beb4517450
17 files changed
+120 -28

No files matched your search

@@ -53,7 +53,12 @@ export default class DisplaySetService {
const activeDisplaySets = this.activeDisplaySets;
displaySets.forEach(displaySet => {
activeDisplaySets.push(displaySet);
// This test makes adding display sets an N^2 operation, so it might
// become important to do this in an efficient manner for large
// numbers of display sets.
if (!activeDisplaySets.includes(displaySet)) {
activeDisplaySets.push(displaySet);
}
});
}
@@ -194,6 +199,17 @@ export default class DisplaySetService {
}
};
/**
* The onModeExit returns the display set service to the initial state,
* that is without any display sets. To avoid recreating display sets,
* the mode specific onModeExit is called before this method and should
* store the active display sets and the cached data.
*/
onModeExit() {
this.getDisplaySetCache().length = 0;
this.activeDisplaySets.length = 0;
}
makeDisplaySetForInstances(instancesSrc, settings) {
let instances = instancesSrc;
const instance = instances[0];