From 35da74708c0050d72033b3a5e77912b8fc5847e5 Mon Sep 17 00:00:00 2001 From: tjcouch-sil Date: Thu, 21 Mar 2024 17:31:17 -0500 Subject: [PATCH] Fixed menu being unavailable on first startup if your machine is too slow to get the renderer up before the extension host needs it --- .../components/platform-bible-toolbar.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/platform-bible-toolbar.tsx b/src/renderer/components/platform-bible-toolbar.tsx index 9d2d39b581..ba74e9e84c 100644 --- a/src/renderer/components/platform-bible-toolbar.tsx +++ b/src/renderer/components/platform-bible-toolbar.tsx @@ -1,5 +1,7 @@ import useSetting from '@renderer/hooks/papi-hooks/use-setting.hook'; +import logger from '@shared/services/logger.service'; import { Toolbar, RefSelector, ScriptureReference, Button } from 'platform-bible-react'; +import { Localized, MultiColumnMenu } from 'platform-bible-utils'; import { handleMenuCommand } from './platform-bible-menu.commands'; import provideMenuData from './platform-bible-menu.data'; @@ -9,6 +11,22 @@ const defaultScrRef: ScriptureReference = { verseNum: 1, }; +/** + * Providing empty menu data if the software fails to load fully so we can shift click the menu and + * click Reload Extensions if it fails the first time + * + * @param isSupportAndDevelopment + * @returns + */ +async function getMenuData(isSupportAndDevelopment: boolean): Promise> { + try { + return await provideMenuData(isSupportAndDevelopment); + } catch (e) { + logger.error(`Could not get platform-bible-toolbar menu data! ${e}`); + return { columns: {}, groups: {}, items: [] }; + } +} + export default function PlatformBibleToolbar() { const [scrRef, setScrRef, resetScrRef] = useSetting('platform.verseRef', defaultScrRef); @@ -17,7 +35,7 @@ export default function PlatformBibleToolbar() { }; return ( - +