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(); 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( const { data: projectInvitations } = useSWR(
workspaceSlug && projectId ? `PROJECT_INVITATIONS_${projectId.toString()}` : null, workspaceSlug && projectId ? `PROJECT_INVITATIONS_${projectId.toString()}` : null,
workspaceSlug && projectId workspaceSlug && projectId

View File

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

View File

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

View File

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