Skip to content

Commit

Permalink
Adding missing null check
Browse files Browse the repository at this point in the history
  • Loading branch information
Maja Grubic committed Jul 17, 2020
1 parent b4972da commit f5061c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugins/visualize/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { schema, TypeOf } from '@kbn/config-schema';

export const configSchema = schema.object({
showNewVisualizeFlow: schema.boolean({ defaultValue: true }),
showNewVisualizeFlow: schema.boolean({ defaultValue: false }),
});

export type ConfigSchema = TypeOf<typeof configSchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ interface VisualizeTopNavProps {
savedVisInstance: SavedVisInstance;
stateContainer: VisualizeAppStateContainer;
visualizationIdFromUrl?: string;
embeddableId?: string;
}

const TopNav = ({
Expand All @@ -56,6 +57,7 @@ const TopNav = ({
savedVisInstance,
stateContainer,
visualizationIdFromUrl,
embeddableId,
}: VisualizeTopNavProps) => {
const { services } = useKibana<VisualizeServices>();
const { TopNavMenu } = services.navigation.ui;
Expand Down Expand Up @@ -89,6 +91,7 @@ const TopNav = ({
savedVisInstance,
stateContainer,
visualizationIdFromUrl,
embeddableId,
},
services
);
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/visualize/public/application/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export const visStateToEditorState = (
) => {
const savedVisState = services.visualizations.convertFromSerializedVis(vis.serialize());
return {
uiState: savedVis.uiStateJSON ? JSON.parse(savedVis.uiStateJSON) : vis.uiState.toJSON(),
uiState:
savedVis && savedVis.uiStateJSON ? JSON.parse(savedVis.uiStateJSON) : vis.uiState.toJSON(),
query: vis.data.searchSource?.getOwnField('query') || getDefaultQuery(services),
filters: (vis.data.searchSource?.getOwnField('filter') as Filter[]) || [],
vis: { ...savedVisState.visState, title: vis.title },
Expand Down

0 comments on commit f5061c7

Please sign in to comment.