mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-30 04:11:33 -08:00
fix: uncaughtException: this.getWorkspacesAsList(...).find is not a function
This commit is contained in:
parent
41c08582d4
commit
57ce9cc1a4
1 changed files with 10 additions and 1 deletions
|
|
@ -169,11 +169,20 @@ export class Workspace implements IWorkspaceService {
|
|||
|
||||
/**
|
||||
* Get sorted workspace list
|
||||
* Async so proxy type is async
|
||||
*/
|
||||
public async getWorkspacesAsList(): Promise<IWorkspace[]> {
|
||||
return Object.values(this.workspaces).sort((a, b) => a.order - b.order);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sorted workspace list
|
||||
* Sync for internal use
|
||||
*/
|
||||
private getWorkspacesAsListSync(): IWorkspace[] {
|
||||
return Object.values(this.workspaces).sort((a, b) => a.order - b.order);
|
||||
}
|
||||
|
||||
public async get(id: string): Promise<IWorkspace | undefined> {
|
||||
return this.workspaces[id];
|
||||
}
|
||||
|
|
@ -216,7 +225,7 @@ export class Workspace implements IWorkspaceService {
|
|||
// we add mainWikiID in creation, we fix this value for old existed workspaces
|
||||
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
||||
if (workspaceToSanitize.isSubWiki && !workspaceToSanitize.mainWikiID) {
|
||||
const mainWorkspace = (this.getWorkspacesAsList() as unknown as IWorkspace[]).find(
|
||||
const mainWorkspace = (this.getWorkspacesAsListSync() ?? []).find(
|
||||
(workspaceToSearch) => workspaceToSanitize.mainWikiToLink === workspaceToSearch.wikiFolderLocation,
|
||||
);
|
||||
if (mainWorkspace !== undefined) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue