From d261a0bd8290e62cc96f5868ef6a8cb1c53cee61 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Mon, 16 Mar 2020 12:28:10 +0300 Subject: [PATCH] Fix redirect when missing index or saved object --- .../kibana_utils/public/history/redirect_when_missing.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/kibana_utils/public/history/redirect_when_missing.tsx b/src/plugins/kibana_utils/public/history/redirect_when_missing.tsx index 69e8dda396008..cbdeef6fbe96c 100644 --- a/src/plugins/kibana_utils/public/history/redirect_when_missing.tsx +++ b/src/plugins/kibana_utils/public/history/redirect_when_missing.tsx @@ -57,9 +57,11 @@ export function redirectWhenMissing({ localMappingObject = mapping; } - return (error: SavedObjectNotFound | Error) => { + return (error: SavedObjectNotFound) => { // if this error is not "404", rethrow - if (!(error instanceof SavedObjectNotFound)) { + // we can't check "error instanceof SavedObjectNotFound" since this class can live in a separate bundle + // and the error will be an instance of other class with the same interface (actually the copy of SavedObjectNotFound class) + if (!error.savedObjectType) { throw error; }