diff --git a/src/pages/Main/index.tsx b/src/pages/Main/index.tsx index 22d4aadb..400c51a2 100644 --- a/src/pages/Main/index.tsx +++ b/src/pages/Main/index.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useCallback } from 'react'; import styled, { css } from 'styled-components'; import { AsyncReturnType } from 'type-fest'; import { DndContext } from '@dnd-kit/core'; @@ -181,7 +181,7 @@ export default function Main(): JSX.Element { return { didFailLoadErrorMessage: 'No ActiveWorkspace' }; // eslint-disable-next-line @typescript-eslint/consistent-type-assertions }, {} as AsyncReturnType); - const requestReload = async (): Promise => await window.service.window.reload(window.meta.windowName); + const requestReload = useCallback(async (): Promise => await window.service.window.reload(window.meta.windowName), [window.meta.windowName]); const workspaceIDs = workspacesList?.map((workspace) => workspace.id) ?? []; return ( @@ -233,53 +233,57 @@ export default function Main(): JSX.Element { - {workspacesList?.length > 0 && mainWorkspaceMetaData?.didFailLoadErrorMessage && mainWorkspaceMetaData?.isLoading === false && ( -
- - Wiki is not started or not loaded - - - {mainWorkspaceMetaData.didFailLoadErrorMessage} - + {Array.isArray(workspacesList) && + workspacesList.length > 0 && + typeof mainWorkspaceMetaData?.didFailLoadErrorMessage === 'string' && + mainWorkspaceMetaData?.didFailLoadErrorMessage.length > 0 && + mainWorkspaceMetaData?.isLoading === false && ( +
+ + Wiki is not started or not loaded + + + {mainWorkspaceMetaData.didFailLoadErrorMessage} + -
- - <> - Try: - -
  • - Click{' '} - - Reload - {' '} - button below or press CMD_or_Ctrl + R to reload the page. -
  • -
  • - Check the{' '} - await window.service.native.open((await window.service.context.get('LOG_FOLDER')) as string, true)} - onKeyPress={async () => await window.service.native.open((await window.service.context.get('LOG_FOLDER')) as string, true)} - role="button" - tabIndex={0} - style={{ cursor: 'pointer' }}> - Log Folder - {' '} - to see what happened. -
  • -
  • Backup your file, remove workspace and recreate one.
  • -
    - -
    +
    + + <> + Try: + +
  • + Click{' '} + + Reload + {' '} + button below or press CMD_or_Ctrl + R to reload the page. +
  • +
  • + Check the{' '} + await window.service.native.open((await window.service.context.get('LOG_FOLDER')) as string, true)} + onKeyPress={async () => await window.service.native.open((await window.service.context.get('LOG_FOLDER')) as string, true)} + role="button" + tabIndex={0} + style={{ cursor: 'pointer' }}> + Log Folder + {' '} + to see what happened. +
  • +
  • Backup your file, remove workspace and recreate one.
  • +
    + +
    - -
    - )} - {workspacesList !== undefined && workspacesList.length > 0 && mainWorkspaceMetaData?.isLoading && ( + +
    + )} + {Array.isArray(workspacesList) && workspacesList.length > 0 && mainWorkspaceMetaData?.isLoading && ( Loading.. )} - {workspacesList?.length === 0 && ( + {Array.isArray(workspacesList) && workspacesList.length === 0 && (
    {sidebar === true ? ( <>