-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
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:
- Disable "visualize:enableLabs" in advanced settings
- Create visualization
- Go to saved object management and change "type" in "visState" to something else (like "thisvistypedoesnotexist")
- Go to Visualize listing page
- Error is shown
Expected behavior:
Visualizations should still be shown with the corrupted one being un-editable.
Any additional context:
In
kibana/src/plugins/visualize/public/application/components/visualize_listing.tsx
Lines 100 to 111 in 19bda1f
| 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 code mapping results from saved object client however leaves it as undefined if the type can't be found in the registry:
kibana/src/plugins/visualizations/public/saved_visualizations/saved_visualizations.ts
Line 47 in bb174fd
| source.error = 'Unknown visualization type'; |
An easy solution would be to declare type as optional and check for existence before accessing it.
A workaround is to enable "visualize:enableLabs"