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

@@ -40,6 +40,9 @@ export default class ExtensionManager {
_extensionLifeCycleHooks,
} = this;
// The onModeEnter of the service must occur BEFORE the extension
// onModeEnter in order to reset the state to a standard state
// before the extension restores and cached data.
for (const service of Object.values(_servicesManager.services)) {
service?.onModeEnter?.();
}
@@ -65,10 +68,6 @@ export default class ExtensionManager {
_extensionLifeCycleHooks,
} = this;
for (const service of Object.values(_servicesManager.services)) {
service?.onModeExit?.();
}
registeredExtensionIds.forEach(extensionId => {
const onModeExit = _extensionLifeCycleHooks.onModeExit[extensionId];
@@ -79,6 +78,16 @@ export default class ExtensionManager {
});
}
});
// The service onModeExit calls must occur after the extension ones
// so that extension ones can store/restore data.
for (const service of Object.values(_servicesManager.services)) {
try {
service?.onModeExit?.();
} catch (e) {
console.warn('onModeExit caught', e);
}
}
}
/**