Skip to content

Unknown visualization type breaks listing page #81881

@flash1293

Description

@flash1293

Kibana version: 7.8 - master

Describe the bug: In a space with "visualize:enableLabs" disabled in advanced settings, if there is a visualization saved object which can't be mapped to an existing type in the visualization registry, the visualization listing page does not render.

Steps to reproduce:

  1. Disable "visualize:enableLabs" in advanced settings
  2. Create visualization
  3. Go to saved object management and change "type" in "visState" to something else (like "thisvistypedoesnotexist")
  4. Go to Visualize listing page
  5. Error is shown

Expected behavior:
Visualizations should still be shown with the corrupted one being un-editable.

Any additional context:
In

const fetchItems = useCallback(
(filter) => {
const isLabsEnabled = uiSettings.get(VISUALIZE_ENABLE_LABS_SETTING);
return savedVisualizations
.findListItems(filter, listingLimit)
.then(({ total, hits }: { total: number; hits: object[] }) => ({
total,
hits: hits.filter((result: any) => isLabsEnabled || result.type.stage !== 'experimental'),
}));
},
[listingLimit, savedVisualizations, uiSettings]
);
, the type is accessed without type guard.

The code mapping results from saved object client however leaves it as undefined if the type can't be found in the registry:

An easy solution would be to declare type as optional and check for existence before accessing it.

A workaround is to enable "visualize:enableLabs"

Metadata

Metadata

Assignees

Labels

Feature:VisualizationsGeneric visualization features (in case no more specific feature label is available)Team:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//bugFixes for quality problems that affect the customer experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions