fix: exception error (#2606)

* fix: exception error

* fix: invitation type
This commit is contained in:
Dakshesh Jain 2023-11-02 16:26:16 +05:30 committed by GitHub
parent 2cda47dc8a
commit 5b808571e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 18 deletions

View File

@ -31,13 +31,6 @@ export const ProjectMemberList: React.FC = observer(() => {
const { user } = useUser();
useSWR(
workspaceSlug && projectId ? `PROJECT_MEMBERS_${projectId.toString().toUpperCase()}` : null,
workspaceSlug && projectId
? () => projectStore.fetchProjectMembers(workspaceSlug.toString(), projectId.toString())
: null
);
const { data: projectInvitations } = useSWR(
workspaceSlug && projectId ? `PROJECT_INVITATIONS_${projectId.toString()}` : null,
workspaceSlug && projectId

View File

@ -102,7 +102,7 @@ export class ProjectLabelStore implements IProjectLabelStore {
[projectId]: (this.rootStore.project.labels?.[projectId] || [])?.map((label) =>
label.id === labelId ? { ...label, ...originalLabel } : label
),
} as any;
};
});
throw error;
}

View File

@ -81,7 +81,7 @@ export class ProjectStateStore implements IProjectStateStore {
};
updateState = async (workspaceSlug: string, projectId: string, stateId: string, data: Partial<IState>) => {
const originalStates = this.rootStore.project.states;
const originalStates = this.rootStore.project.states || {};
runInAction(() => {
this.rootStore.project.states = {
@ -120,13 +120,7 @@ export class ProjectStateStore implements IProjectStateStore {
} catch (error) {
console.log("Failed to update state from project store");
runInAction(() => {
this.rootStore.project.states = {
...this.rootStore.project.states,
[projectId]: {
...this.rootStore.project.states?.[projectId],
[data.group as string]: originalStates || [],
},
} as any;
this.rootStore.project.states = originalStates;
});
throw error;
}

View File

@ -122,7 +122,7 @@ class UserStore implements IUserStore {
get currentWorkspaceRole() {
if (!this.rootStore.workspace.workspaceSlug) return;
return this.workspaceMemberInfo[this.rootStore.workspace.workspaceSlug].role;
return this.workspaceMemberInfo[this.rootStore.workspace.workspaceSlug]?.role;
}
get currentProjectMemberInfo() {
@ -132,7 +132,7 @@ class UserStore implements IUserStore {
get currentProjectRole() {
if (!this.rootStore.project.projectId) return;
return this.projectMemberInfo[this.rootStore.project.projectId].role;
return this.projectMemberInfo[this.rootStore.project.projectId]?.role;
}
get hasPermissionToCurrentWorkspace() {