chore: create extended root store (#4796)

* chore: create extended root store

* chore: rename core root store
This commit is contained in:
Aaryan Khandelwal 2024-06-13 13:27:13 +05:30 committed by GitHub
parent d81a476e0b
commit 703aac597c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 103 additions and 65 deletions

View File

@ -0,0 +1,8 @@
// store
import { CoreRootStore } from "@/store/root.store";
export class RootStore extends CoreRootStore {
constructor() {
super();
}
}

View File

@ -1,8 +1,8 @@
"use client";
import { ReactElement, createContext } from "react";
// mobx store
import { RootStore } from "@/store/root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
export let rootStore = new RootStore();

View File

@ -8,13 +8,13 @@ import { ICycle, CycleDateCheckData, TCyclePlotType } from "@plane/types";
// helpers
import { orderCycles, shouldFilterCycle } from "@/helpers/cycle.helper";
import { getDate } from "@/helpers/date-time.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { CycleService } from "@/services/cycle.service";
import { CycleArchiveService } from "@/services/cycle_archive.service";
import { IssueService } from "@/services/issue";
import { ProjectService } from "@/services/project";
// store
import { RootStore } from "@/store/root.store";
export interface ICycleStore {
// loaders

View File

@ -3,8 +3,8 @@ import { action, computed, observable, makeObservable, runInAction, reaction } f
import { computedFn } from "mobx-utils";
// types
import { TCycleDisplayFilters, TCycleFilters, TCycleFiltersByState } from "@plane/types";
// store
import { RootStore } from "@/store/root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
export interface ICycleFilterStore {
// observables

View File

@ -10,10 +10,10 @@ import {
TWidgetKeys,
TWidgetStatsRequestParams,
} from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { DashboardService } from "@/services/dashboard.service";
// stores
import { RootStore } from "@/store/root.store";
export interface IDashboardStore {
// error states

View File

@ -1,10 +1,11 @@
import set from "lodash/set";
import { action, computed, makeObservable, observable, runInAction } from "mobx";
// types
import { IEstimate, IEstimatePoint as IEstimatePointType } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import estimateService from "@/services/project/estimate.service";
// store
import { RootStore } from "@/store/root.store";
type TErrorCodes = {
status: string;

View File

@ -3,6 +3,7 @@ import set from "lodash/set";
import unset from "lodash/unset";
import { action, computed, makeObservable, observable, runInAction } from "mobx";
import { computedFn } from "mobx-utils";
// types
import {
IEstimate as IEstimateType,
IEstimatePoint as IEstimatePointType,
@ -10,11 +11,12 @@ import {
IEstimateFormData,
TEstimatePointsObject,
} from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import estimateService from "@/services/project/estimate.service";
// store
import { IEstimatePoint, EstimatePoint } from "@/store/estimates/estimate-point";
import { RootStore } from "@/store/root.store";
type TErrorCodes = {
status: string;

View File

@ -4,12 +4,14 @@ import unset from "lodash/unset";
import update from "lodash/update";
import { action, computed, makeObservable, observable, runInAction } from "mobx";
import { computedFn } from "mobx-utils";
// types
import { IEstimate as IEstimateType, IEstimateFormData } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import estimateService from "@/services/project/estimate.service";
// store
import { IEstimate, Estimate } from "@/store/estimates/estimate";
import { RootStore } from "@/store/root.store";
type TEstimateLoader = "init-loader" | "mutation-loader" | undefined;
type TErrorCodes = {

View File

@ -14,7 +14,8 @@ import {
getWorkspaceEventPayload,
getPageEventPayload,
} from "@/constants/event-tracker";
import { RootStore } from "./root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
export interface IEventTrackerStore {
// properties

View File

@ -7,10 +7,10 @@ import { computedFn } from "mobx-utils";
import { IIssueFilterOptions, IWorkspaceView } from "@plane/types";
// constants
import { EIssueFilterType } from "@/constants/issue";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { WorkspaceService } from "@/services/workspace.service";
// types
import { RootStore } from "@/store/root.store";
export interface IGlobalViewStore {
// observables

View File

@ -4,11 +4,11 @@ import { makeObservable, observable, runInAction, action } from "mobx";
import { TIssue, TInboxIssue, TInboxIssueStatus, TInboxDuplicateIssueDetails } from "@plane/types";
// helpers
import { EInboxIssueStatus } from "@/helpers/inbox.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { InboxIssueService } from "@/services/inbox";
import { IssueService } from "@/services/issue";
// root store
import { RootStore } from "@/store/root.store";
export interface IInboxIssueStore {
isLoading: boolean;
@ -44,7 +44,12 @@ export class InboxIssueStore implements IInboxIssueStore {
inboxIssueService;
issueService;
constructor(workspaceSlug: string, projectId: string, data: TInboxIssue, private store: RootStore) {
constructor(
workspaceSlug: string,
projectId: string,
data: TInboxIssue,
private store: RootStore
) {
this.id = data.id;
this.status = data.status;
this.issue = data?.issue;

View File

@ -15,11 +15,12 @@ import {
} from "@plane/types";
// helpers
import { EInboxIssueCurrentTab, EInboxIssueStatus, EPastDurationFilters, getCustomDates } from "@/helpers/inbox.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { InboxIssueService } from "@/services/inbox";
// root store
import { IInboxIssueStore, InboxIssueStore } from "@/store/inbox/inbox-issue.store";
import { RootStore } from "@/store/root.store";
type TLoader =
| "init-loading"

View File

@ -1,9 +1,11 @@
import { action, computed, makeObservable, observable } from "mobx";
import { computedFn } from "mobx-utils";
import { IssueRootStore } from "./root.store";
import { TIssueGroupByOptions } from "@plane/types";
import { DRAG_ALLOWED_GROUPS } from "@/constants/issue";
// types
import { TIssueGroupByOptions } from "@plane/types";
// constants
import { DRAG_ALLOWED_GROUPS } from "@/constants/issue";
// store
import { IssueRootStore } from "./root.store";
export interface IIssueKanBanViewStore {
kanBanToggle: {

View File

@ -1,9 +1,10 @@
import isEmpty from "lodash/isEmpty";
import { autorun, makeObservable, observable } from "mobx";
import { ICycle, IIssueLabel, IModule, IProject, IState, IUserLite } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// root store
import { IWorkspaceMembership } from "@/store/member/workspace-member.store";
import { RootStore } from "../root.store";
import { IStateStore, StateStore } from "../state.store";
// issues data store
import { IArchivedIssuesFilter, ArchivedIssuesFilter, IArchivedIssues, ArchivedIssues } from "./archived";

View File

@ -6,10 +6,10 @@ import { computedFn } from "mobx-utils";
import { IIssueLabel, IIssueLabelTree } from "@plane/types";
// helpers
import { buildTree } from "@/helpers/array.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { IssueLabelService } from "@/services/issue";
// store
import { RootStore } from "@/store/root.store";
export interface ILabelStore {
//Loaders

View File

@ -1,7 +1,8 @@
import { action, makeObservable, observable } from "mobx";
// types
import { IUserLite } from "@plane/types";
import { RootStore } from "@/store/root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
import { IProjectMemberStore, ProjectMemberStore } from "./project-member.store";
import { IWorkspaceMemberStore, WorkspaceMemberStore } from "./workspace-member.store";

View File

@ -6,10 +6,11 @@ import { computedFn } from "mobx-utils";
import { IProjectBulkAddFormData, IProjectMember, IProjectMembership, IUserLite } from "@plane/types";
// constants
import { EUserProjectRoles } from "@/constants/project";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { ProjectMemberService } from "@/services/project";
// store
import { RootStore } from "@/store/root.store";
import { IRouterStore } from "@/store/router.store";
import { IUserStore } from "@/store/user";
import { IMemberRootStore } from ".";

View File

@ -6,10 +6,11 @@ import { computedFn } from "mobx-utils";
import { IWorkspaceBulkInviteFormData, IWorkspaceMember, IWorkspaceMemberInvitation } from "@plane/types";
// constants
import { EUserWorkspaceRoles } from "@/constants/workspace";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { WorkspaceService } from "@/services/workspace.service";
// types
import { RootStore } from "@/store/root.store";
import { IRouterStore } from "@/store/router.store";
import { IUserStore } from "@/store/user";
import { IMemberRootStore } from ".";

View File

@ -8,12 +8,12 @@ import { computedFn } from "mobx-utils";
import { IModule, ILinkDetails, TModulePlotType } from "@plane/types";
// helpers
import { orderModules, shouldFilterModule } from "@/helpers/module.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { ModuleService } from "@/services/module.service";
import { ModuleArchiveService } from "@/services/module_archive.service";
import { ProjectService } from "@/services/project";
// store
import { RootStore } from "@/store/root.store";
export interface IModuleStore {
//Loaders

View File

@ -3,8 +3,8 @@ import { action, computed, observable, makeObservable, runInAction, reaction } f
import { computedFn } from "mobx-utils";
// types
import { TModuleDisplayFilters, TModuleFilters, TModuleFiltersByState } from "@plane/types";
// store
import { RootStore } from "@/store/root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
export interface IModuleFilterStore {
// observables

View File

@ -5,9 +5,10 @@ import { TLogoProps, TPage } from "@plane/types";
// constants
import { EPageAccess } from "@/constants/page";
import { EUserProjectRoles } from "@/constants/project";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { ProjectPageService } from "@/services/page";
import { RootStore } from "../root.store";
export type TLoader = "submitting" | "submitted" | "saved";

View File

@ -6,11 +6,12 @@ import { computedFn } from "mobx-utils";
import { TPage, TPageFilters, TPageNavigationTabs } from "@plane/types";
// helpers
import { filterPagesByPageType, getPageName, orderPages, shouldFilterPage } from "@/helpers/page.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { ProjectPageService } from "@/services/page";
// store
import { IPageStore, PageStore } from "@/store/pages/page.store";
import { RootStore } from "../root.store";
type TLoader = "init-loader" | "mutation-loader" | undefined;

View File

@ -3,9 +3,10 @@ import { observable, action, makeObservable, runInAction, computed } from "mobx"
import { computedFn } from "mobx-utils";
// types
import { IProjectView } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { ViewService } from "@/services/view.service";
import { RootStore } from "@/store/root.store";
export interface IProjectViewStore {
//Loaders

View File

@ -1,4 +1,5 @@
import { RootStore } from "@/store/root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
import { IProjectPublishStore, ProjectPublishStore } from "./project-publish.store";
import { IProjectStore, ProjectStore } from "./project.store";
import { IProjectFilterStore, ProjectFilterStore } from "./project_filter.store";

View File

@ -6,11 +6,11 @@ import { computedFn } from "mobx-utils";
import { IProject } from "@plane/types";
// helpers
import { orderProjects, shouldFilterProject } from "@/helpers/project.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { IssueLabelService, IssueService } from "@/services/issue";
import { ProjectService, ProjectStateService, ProjectArchiveService } from "@/services/project";
// store
import { RootStore } from "../root.store";
export interface IProjectStore {
// observables

View File

@ -3,8 +3,8 @@ import { action, computed, observable, makeObservable, runInAction, reaction } f
import { computedFn } from "mobx-utils";
// types
import { TProjectDisplayFilters, TProjectFilters, TProjectAppliedDisplayFilterKeys } from "@plane/types";
// store
import { RootStore } from "@/store/root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
export interface IProjectFilterStore {
// observables

View File

@ -26,7 +26,7 @@ import { IWorkspaceRootStore, WorkspaceRootStore } from "./workspace";
enableStaticRendering(typeof window === "undefined");
export class RootStore {
export class CoreRootStore {
workspaceRoot: IWorkspaceRootStore;
projectRoot: IProjectRootStore;
memberRoot: IMemberRootStore;

View File

@ -2,14 +2,14 @@ import groupBy from "lodash/groupBy";
import set from "lodash/set";
import { makeObservable, observable, computed, action, runInAction } from "mobx";
import { computedFn } from "mobx-utils";
import { IState } from "@plane/types";
// store
import { sortStates } from "@/helpers/state.helper";
import { ProjectStateService } from "@/services/project";
import { RootStore } from "./root.store";
// types
// services
import { IState } from "@plane/types";
// helpers
import { sortStates } from "@/helpers/state.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { ProjectStateService } from "@/services/project";
export interface IStateStore {
//Loaders

View File

@ -1,6 +1,6 @@
import { action, observable, makeObservable } from "mobx";
// store types
import { RootStore } from "@/store/root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
export interface IThemeStore {
// observables

View File

@ -1,10 +1,11 @@
import set from "lodash/set";
import { makeObservable, observable } from "mobx";
// types
import { IUserAccount } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { UserService } from "@/services/user.service";
// stores
import { RootStore } from "@/store/root.store";
export interface IAccountStore {
// observables

View File

@ -5,11 +5,12 @@ import { action, makeObservable, observable, runInAction } from "mobx";
import { IUser } from "@plane/types";
// helpers
import { API_BASE_URL } from "@/helpers/common.helper";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { AuthService } from "@/services/auth.service";
import { UserService } from "@/services/user.service";
// stores
import { RootStore } from "@/store/root.store";
import { IAccountStore } from "@/store/user/account.store";
import { ProfileStore, IUserProfileStore } from "@/store/user/profile.store";
import { IUserMembershipStore, UserMembershipStore } from "@/store/user/user-membership.store";

View File

@ -1,11 +1,12 @@
import cloneDeep from "lodash/cloneDeep";
import set from "lodash/set";
import { action, makeObservable, observable, runInAction } from "mobx";
// services
import { UserService } from "@/services/user.service";
// types
import { IUserTheme, TUserProfile } from "@plane/types";
import { RootStore } from "@/store/root.store";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { UserService } from "@/services/user.service";
type TError = {
status: string;

View File

@ -5,12 +5,12 @@ import { IWorkspaceMemberMe, IProjectMember, IUserProjectsRole } from "@plane/ty
// constants
import { EUserProjectRoles } from "@/constants/project";
import { EUserWorkspaceRoles } from "@/constants/workspace";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { ProjectMemberService } from "@/services/project";
import { UserService } from "@/services/user.service";
import { WorkspaceService } from "@/services/workspace.service";
// store
import { RootStore } from "../root.store";
export interface IUserMembershipStore {
// observables

View File

@ -1,10 +1,11 @@
// mobx
import { action, observable, makeObservable, runInAction } from "mobx";
import { computedFn } from "mobx-utils";
import { APITokenService } from "@/services/api_token.service";
import { IApiToken } from "@plane/types";
import { RootStore } from "../root.store";
// types
import { IApiToken } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { APITokenService } from "@/services/api_token.service";
export interface IApiTokenStore {
// observables

View File

@ -1,10 +1,11 @@
import set from "lodash/set";
import { action, computed, observable, makeObservable, runInAction } from "mobx";
import { IWorkspace } from "@plane/types";
import { WorkspaceService } from "@/services/workspace.service";
import { RootStore } from "../root.store";
// types
import { IWorkspace } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { WorkspaceService } from "@/services/workspace.service";
// sub-stores
import { ApiTokenStore, IApiTokenStore } from "./api-token.store";
import { IWebhookStore, WebhookStore } from "./webhook.store";

View File

@ -1,9 +1,12 @@
// mobx
import { action, observable, makeObservable, computed, runInAction } from "mobx";
import { computedFn } from "mobx-utils";
// types
import { IWebhook } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { WebhookService } from "@/services/webhook.service";
import { RootStore } from "../root.store";
export interface IWebhookStore {
// observables