From e7ac579d1cef1a056aa024ea08e95405b4b21af8 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 24 Jul 2023 07:46:34 -0700 Subject: [PATCH] Fix exception `initial databaseList request failed: T.sort is not a function` Summary: Exception showed up in our monitoring. The only `.sort` that happens in that request/response sequence is the one updated. Didn't get to the root of this, but likely the plugin returns nothing rather than an empty array when no databases present? Reviewed By: LukeDefeo Differential Revision: D47665268 fbshipit-source-id: 3f8dea591db3e6cb5d4e0d09f893a177ad4f642e --- desktop/plugins/public/databases/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/plugins/public/databases/index.tsx b/desktop/plugins/public/databases/index.tsx index d5f20076b..f2879dfbb 100644 --- a/desktop/plugins/public/databases/index.tsx +++ b/desktop/plugins/public/databases/index.tsx @@ -108,7 +108,7 @@ export function plugin(client: PluginClient) { const updateDatabases = (event: { databases: Array<{name: string; id: number; tables: Array}>; }) => { - const updates = event.databases; + const updates = event.databases ?? []; const state = pluginState.get(); const databases = updates.sort((db1, db2) => db1.id - db2.id); const selectedDatabase =