fix: resolved issue creation error in layouts while group_by and sub_group_by filters applied in quick add (#4761)

This commit is contained in:
guru_sainath 2024-06-11 14:55:35 +05:30 committed by GitHub
parent 346bc2afe2
commit 59376ee3da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 9 deletions

View File

@ -7,7 +7,14 @@ import set from "lodash/set";
import uniq from "lodash/uniq";
import update from "lodash/update";
// types
import { TIssue, TLoader, IssuePaginationOptions, TIssuesResponse, ViewFlags, TBulkOperationsPayload } from "@plane/types";
import {
TIssue,
TLoader,
IssuePaginationOptions,
TIssuesResponse,
ViewFlags,
TBulkOperationsPayload,
} from "@plane/types";
import { IIssueRootStore } from "../root.store";
import { BaseIssuesStore, IBaseIssuesStore } from "../helpers/base-issues.store";
import { ICycleIssuesFilter } from "./filter.store";
@ -391,9 +398,13 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
this.rootIssueStore.issues.removeIssue(data.id);
});
if (data.module_ids && data.module_ids.length > 0) {
await this.changeModulesInIssue(workspaceSlug, projectId, response.id, data.module_ids, []);
const currentModuleIds =
data.module_ids && data.module_ids.length > 0 ? data.module_ids.filter((moduleId) => moduleId != "None") : [];
if (currentModuleIds.length > 0) {
await this.changeModulesInIssue(workspaceSlug, projectId, response.id, currentModuleIds, []);
}
return response;
} catch (error) {
throw error;

View File

@ -680,12 +680,20 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
this.rootIssueStore.issues.removeIssue(data.id);
});
if (data.cycle_id && data.cycle_id !== "" && !this.cycleId) {
await this.addCycleToIssue(workspaceSlug, projectId, data.cycle_id, response.id);
const currentCycleId = data.cycle_id !== "" && data.cycle_id === "None" ? undefined : data.cycle_id;
const currentModuleIds =
data.module_ids && data.module_ids.length > 0 ? data.module_ids.filter((moduleId) => moduleId != "None") : [];
const promiseRequests = [];
if (currentCycleId) {
promiseRequests.push(this.addCycleToIssue(workspaceSlug, projectId, currentCycleId, response.id));
}
if (currentModuleIds.length > 0) {
promiseRequests.push(this.changeModulesInIssue(workspaceSlug, projectId, response.id, currentModuleIds, []));
}
if (data.module_ids && data.module_ids.length > 0 && !this.moduleId) {
await this.changeModulesInIssue(workspaceSlug, projectId, response.id, data.module_ids, []);
if (promiseRequests && promiseRequests.length > 0) {
await Promise.all(promiseRequests);
}
return response;

View File

@ -234,9 +234,12 @@ export class ModuleIssues extends BaseIssuesStore implements IModuleIssues {
this.rootIssueStore.issues.removeIssue(data.id);
});
if (data.cycle_id && data.cycle_id !== "") {
await this.addCycleToIssue(workspaceSlug, projectId, data.cycle_id, response.id);
const currentCycleId = data.cycle_id !== "" && data.cycle_id === "None" ? undefined : data.cycle_id;
if (currentCycleId) {
await this.addCycleToIssue(workspaceSlug, projectId, currentCycleId, response.id);
}
return response;
} catch (error) {
throw error;