Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Mar 19, 2020
1 parent 3591126 commit b4da458
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ function VisualizeAppController(

$scope.embeddableHandler = embeddableHandler;

const handleUiStateChange = () => {
stateContainer.transitions.updateUiState(visStateToEditorState().uiState);
};

$scope.vis.uiState.on('change', handleUiStateChange);

$scope.topNavMenu = [
...(visualizeCapabilities.save
? [
Expand Down Expand Up @@ -576,6 +582,7 @@ function VisualizeAppController(
savedVis.destroy();
subscriptions.unsubscribe();
$scope.eventEmitter.off('apply', _applyVis);
$scope.vis.uiState.off('change', handleUiStateChange);

unsubscribePersisted();
unsubscribeStateUpdates();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function useVisualizeAppState({ stateDefaults, kbnUrlStateStorage }: Argu
linked: false,
}),
updateVisState: state => newVisState => ({ ...state, vis: toObject(newVisState) }),
updateUiState: state => newUiState => ({ ...state, uiState: newUiState }),
updateFromSavedQuery: state => savedQuery => ({
...state,
savedQuery: savedQuery.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface VisualizeAppStateTransitions {
state: VisualizeAppState
) => ({ query, parentFilters }: { query?: Query; parentFilters?: Filter[] }) => VisualizeAppState;
updateVisState: (state: VisualizeAppState) => (vis: PureVisState) => VisualizeAppState;
updateUiState: (state: VisualizeAppState) => (uiState: PersistedState) => VisualizeAppState;
updateFromSavedQuery: (state: VisualizeAppState) => (savedQuery: SavedQuery) => VisualizeAppState;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
});
this.vis.uiState.on('change', this.uiStateChangeHandler);
}
} else if (this.parent) {
this.vis.uiState.clearAllKeys();
}
}

Expand Down

0 comments on commit b4da458

Please sign in to comment.