Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Fix loading forecasts from anomaly job list. (#41034)
Fixes a bug where opening a forecast from the anomaly jobs list several times would not show the forecast. The bug was caused because the observable mlJobSelectService was triggered on mounting the mlJobSelectorReactWrapper to pass on the currently selected job. However, because this directive is a child of MlTimeSeriesExplorerController it would do this check only after this controller is already initialized but also need the current jobs. The result was that the controller would receive first the out-of-date jobs and only then the new job ids. The second trigger unsets the forecast, because it's expected to only be triggered multiple times by the job selector. The fix introduced here solves the problem by triggered the observable directly from mlJobSelectService, because the service is only set up once in contrast to a directive. globalState offers some listeners which can be used to trigger callbacks on certain events within globalState. We can use save_with_changes to subscribe to updates when globalState.save() gets called.
- Loading branch information