Skip to content

Commit

Permalink
[native] fix(Account): Don't try to load LocalTabs resource
Browse files Browse the repository at this point in the history
fixes #1563

Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Mar 18, 2024
1 parent 22a79e1 commit c169351
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/lib/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,7 @@ export default class Account {
}

async getResource():Promise<IResource> {
if (this.getData().localRoot !== 'tabs') {
return this.localTree
} else {
const LocalTabs = (await import('./LocalTabs')).default
this.localTabs = new LocalTabs(this.storage)
return this.localTabs
}
return this.localTree
}

async setData(data:IAccountData):Promise<void> {
Expand Down Expand Up @@ -155,14 +149,7 @@ export default class Account {
await this.init()
}

let localResource
if (this.getData().localRoot !== 'tabs') {
localResource = this.localTree
} else {
const LocalTabs = (await import('./LocalTabs')).default
this.localTabs = new LocalTabs(this.storage)
localResource = this.localTabs
}
const localResource = await this.getResource()

if (this.server.onSyncStart) {
const needLock = (strategy || this.getData().strategy) !== 'slave'
Expand Down
11 changes: 11 additions & 0 deletions src/lib/browser/BrowserAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
UnknownFolderItemOrderError
} from '../../errors/Error'
import {i18n} from '../native/I18n'
import { IResource } from '../interfaces/Resource'

export default class BrowserAccount extends Account {
static async get(id:string):Promise<Account> {
Expand Down Expand Up @@ -65,6 +66,16 @@ export default class BrowserAccount extends Account {
}
}

async getResource():Promise<IResource> {
if (this.getData().localRoot !== 'tabs') {
return this.localTree
} else {
const LocalTabs = (await import('../LocalTabs')).default
this.localTabs = new LocalTabs(this.storage)
return this.localTabs
}
}

async updateFromStorage():Promise<void> {
const data = await this.storage.getAccountData(null)
this.server.setData(data)
Expand Down

0 comments on commit c169351

Please sign in to comment.