fix: minor issues

This commit is contained in:
lin onetwo 2025-10-30 04:08:49 +08:00
parent 2e23d5cf9e
commit e4e97fadd3
4 changed files with 11 additions and 12 deletions

View file

@ -146,7 +146,7 @@ Then('file {string} should exist in {string}', { timeout: 15000 }, async functio
BACKOFF_OPTIONS,
);
} catch {
// Get 1 levels up from actualPath
// Get 1 level up from actualPath
const oneLevelsUp = path.resolve(directoryPath, '..');
const tree = await getDirectoryTree(oneLevelsUp);
@ -172,7 +172,7 @@ Then('file {string} should exist in {string}', { timeout: 15000 }, async functio
throw new Error(
`File "${fileName}" not found in directory: ${directoryPath}\n\n` +
`Directory tree (1 levels up from ${oneLevelsUp}):\n${tree}${tidFilesContent}`,
`Directory tree (1 level up from ${oneLevelsUp}):\n${tree}${tidFilesContent}`,
);
}
});

View file

@ -50,7 +50,7 @@ const Tab = styled(TabRaw)`
interface Props {
storageProvider?: SupportedStorageServices;
storageProviderSetter?: React.Dispatch<React.SetStateAction<SupportedStorageServices>>;
storageProviderSetter?: (value: SupportedStorageServices) => void;
}
/**
* Create storage provider's token.
@ -58,12 +58,10 @@ interface Props {
*/
export function TokenForm({ storageProvider, storageProviderSetter }: Props): React.JSX.Element {
const { t } = useTranslation();
let [currentTab, currentTabSetter] = useState<SupportedStorageServices>(SupportedStorageServices.github);
const [internalTab, internalTabSetter] = useState<SupportedStorageServices>(SupportedStorageServices.github);
// use external controls if provided
if (storageProvider !== undefined && typeof storageProviderSetter === 'function') {
currentTab = storageProvider;
currentTabSetter = storageProviderSetter;
}
const currentTab = storageProvider ?? internalTab;
const currentTabSetter = storageProviderSetter ?? internalTabSetter;
// update storageProvider to be an online service, if this Component is opened
useEffect(() => {
if (storageProvider === SupportedStorageServices.local && typeof storageProviderSetter === 'function') {

View file

@ -40,7 +40,10 @@ class TidGiIPCSyncAdaptor {
this.isReadOnly = false;
this.logoutIsAvailable = true;
const workspaceID = (window.meta() as WindowMeta[WindowNames.view]).workspace?.id;
this.workspaceID = workspaceID!;
if (workspaceID === undefined) {
throw new Error('TidGiIPCSyncAdaptor: workspaceID is undefined. Cannot initialize sync adaptor without a valid workspace ID.');
}
this.workspaceID = workspaceID;
if (window.observables?.wiki?.getWikiChangeObserver$ !== undefined) {
// if install-electron-ipc-cat is faster than us, just subscribe to the observable. Otherwise we normally will wait for it to call us here.
this.setupSSE();

View file

@ -319,9 +319,7 @@ export default function EditWorkspace(): React.JSX.Element {
<TokenForm
storageProvider={storageService}
storageProviderSetter={(nextStorageService) => {
const actualStorageService = typeof nextStorageService === 'function' ? nextStorageService(storageService) : nextStorageService;
workspaceSetter({ ...workspace, storageService: actualStorageService });
// requestRestartCountDown();
workspaceSetter({ ...workspace, storageService: nextStorageService });
}}
/>
)}