Skip to content

[Visualize] Improve Listing page error handling #238351

@nickofthyme

Description

@nickofthyme

On the visualize_listing.tsx component, we list all vis types with edit strings. The types for the savedObject are very loose due to #231528 as shown below...

const toTableListViewSavedObject = (savedObject: Record<string, unknown>): VisualizeUserContent => {
return {
id: savedObject.id as string,
updatedAt: savedObject.updatedAt as string,
managed: savedObject.managed as boolean,
references: savedObject.references as Array<{ id: string; type: string; name: string }>,
type: savedObject.savedObjectType as string,
icon: savedObject.icon as string,
stage: savedObject.stage as VisualizationStage,
savedObjectType: savedObject.savedObjectType as string,
typeTitle: savedObject.typeTitle as string,
title: (savedObject.title as string) ?? '',
error: (savedObject.error as string) ?? '',
editor: savedObject.editor as any,
attributes: {
id: savedObject.id as string,
title: (savedObject.title as string) ?? '',
description: savedObject.description as string,
readOnly: savedObject.readOnly as boolean,
error: savedObject.error as string,
},
};
};

But aside from these loose types, the error from the savedObject is completely ignored which can result in the entire page erroring instead of a single vis.

For example, here we are getting the getDetailViewLink for each vis, but in some cases there is an error which leads to editor being undefined. But since we don't catch the error at the vis level, we throw at the page level 🤦🏼‍♂️.

getDetailViewLink={({ editor, attributes: { error, readOnly } }) =>
readOnly || (editor && 'onEdit' in editor)
? undefined
: getVisualizeListItemLink(
application,
kbnUrlStateStorage,
editor.editApp,
editor.editUrl,
error
)
}

We should be better at catching these issues and displaying errors for each vis and avoid full page errors.

Metadata

Metadata

Assignees

No one assigned

    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//

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions