Skip to content

Commit

Permalink
fix cache failure issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
TulshiDas39 committed Dec 9, 2024
1 parent 6b68346 commit e9823c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions ui/src/lib/utils/CacheUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ export enum CacheKey{

export class CacheUtils{
static async setRepoDetails(data:IRepositoryDetails){
await localforage.setItem(CacheKey.repoDetails+data.repoInfo.path,data);
try {
await localforage.setItem(CacheKey.repoDetails+data.repoInfo.path,data);
} catch (error) {
}
}

static async getRepoDetails(path:string){
const res = await localforage.getItem<IRepositoryDetails>(CacheKey.repoDetails+path);
return res;
try{
const res = await localforage.getItem<IRepositoryDetails>(CacheKey.repoDetails+path);
return res;
}catch(e){
return null!;
}

}

static async clearRepoDetails(path:string){
Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/utils/RepoUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ export class RepoUtils{
}

static get activeRemoteInfo(){
if(!RepoUtils.repositoryDetails.remotes.length)
if(!RepoUtils.repositoryDetails?.remotes.length)
return undefined;
const orignName = RepoUtils.repositoryDetails.repoInfo.activeOrigin;
const remote = RepoUtils.repositoryDetails.remotes.find(_=> _.name === orignName);
Expand Down

0 comments on commit e9823c7

Please sign in to comment.