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 uniq from "lodash/uniq";
import update from "lodash/update"; import update from "lodash/update";
// types // 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 { IIssueRootStore } from "../root.store";
import { BaseIssuesStore, IBaseIssuesStore } from "../helpers/base-issues.store"; import { BaseIssuesStore, IBaseIssuesStore } from "../helpers/base-issues.store";
import { ICycleIssuesFilter } from "./filter.store"; import { ICycleIssuesFilter } from "./filter.store";
@ -391,9 +398,13 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
this.rootIssueStore.issues.removeIssue(data.id); this.rootIssueStore.issues.removeIssue(data.id);
}); });
if (data.module_ids && data.module_ids.length > 0) { const currentModuleIds =
await this.changeModulesInIssue(workspaceSlug, projectId, response.id, data.module_ids, []); 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; return response;
} catch (error) { } catch (error) {
throw error; throw error;

View File

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

View File

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