fix: reloading on favorite action (#5313)

This commit is contained in:
Akshita Goyal 2024-08-07 12:58:24 +05:30 committed by GitHub
parent 3279bb6ac9
commit 806eae0139
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -285,7 +285,6 @@ export class ProjectStore implements IProjectStore {
project_id: projectId,
entity_data: { name: this.projectMap[projectId].name || "" },
});
await this.fetchProjects(workspaceSlug);
return response;
} catch (error) {
console.log("Failed to add project to favorite");
@ -306,12 +305,11 @@ export class ProjectStore implements IProjectStore {
try {
const currentProject = this.getProjectById(projectId);
if (!currentProject.is_favorite) return;
const response = await this.rootStore.favorite.removeFavoriteEntity(workspaceSlug.toString(), projectId);
runInAction(() => {
set(this.projectMap, [projectId, "is_favorite"], false);
});
await this.fetchProjects(workspaceSlug);
const response = await this.rootStore.favorite.removeFavoriteEntity(workspaceSlug.toString(), projectId);
return response;
} catch (error) {
console.log("Failed to add project to favorite");