fix: core root store import fixes

This commit is contained in:
sriram veeraghanta 2024-06-14 03:37:18 +05:30
parent c9147e7a57
commit 78d4d981d1
20 changed files with 61 additions and 69 deletions

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 { CoreRootStore } from "./root.store";
export interface ICycleStore {
// loaders
@ -84,7 +84,7 @@ export class CycleStore implements ICycleStore {
cycleService;
cycleArchiveService;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// observables
loader: observable.ref,

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";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// store
import { CoreRootStore } from "./root.store";
export interface ICycleFilterStore {
// observables
@ -35,9 +35,9 @@ export class CycleFilterStore implements ICycleFilterStore {
searchQuery: string = "";
archivedCyclesSearchQuery: string = "";
// root store
rootStore: RootStore;
rootStore: CoreRootStore;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// observables
displayFilters: observable,

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";
// plane web store
import { CoreRootStore } from "./root.store";
export interface IDashboardStore {
// error states
@ -74,7 +74,7 @@ export class DashboardStore implements IDashboardStore {
// services
dashboardService;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// error states
widgetStatsError: observable,

View File

@ -6,12 +6,11 @@ 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 { CoreRootStore } from "../root.store";
type TEstimateLoader = "init-loader" | "mutation-loader" | undefined;
type TErrorCodes = {
@ -52,7 +51,7 @@ export class ProjectEstimateStore implements IProjectEstimateStore {
estimates: Record<string, IEstimate> = {}; // estimate_id -> estimate
error: TErrorCodes | undefined = undefined;
constructor(private store: RootStore) {
constructor(private store: CoreRootStore) {
makeObservable(this, {
// observables
loader: observable.ref,

View File

@ -14,8 +14,8 @@ import {
getWorkspaceEventPayload,
getPageEventPayload,
} from "@/constants/event-tracker";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// store
import { CoreRootStore } from "./root.store";
export interface IEventTrackerStore {
// properties
@ -39,7 +39,7 @@ export interface IEventTrackerStore {
export class EventTrackerStore implements IEventTrackerStore {
trackElement: string | undefined = undefined;
rootStore;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// properties
trackElement: observable,

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";
// store
import { CoreRootStore } from "./root.store";
export interface IGlobalViewStore {
// observables
@ -41,7 +41,7 @@ export class GlobalViewStore implements IGlobalViewStore {
// services
workspaceService;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// observables
globalViewMap: observable,

View File

@ -15,12 +15,11 @@ 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 { CoreRootStore } from "../root.store";
type TLoader =
| "init-loading"
@ -90,7 +89,7 @@ export class ProjectInboxStore implements IProjectInboxStore {
// services
inboxIssueService;
constructor(private store: RootStore) {
constructor(private store: CoreRootStore) {
makeObservable(this, {
currentTab: observable.ref,
loader: observable.ref,

View File

@ -1,10 +1,9 @@
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 { CoreRootStore } from "../root.store";
import { IStateStore, StateStore } from "../state.store";
// issues data store
import { IArchivedIssuesFilter, ArchivedIssuesFilter, IArchivedIssues, ArchivedIssues } from "./archived";
@ -44,7 +43,7 @@ export interface IIssueRootStore {
moduleMap: Record<string, IModule> | undefined;
cycleMap: Record<string, ICycle> | undefined;
rootStore: RootStore;
rootStore: CoreRootStore;
issues: IIssueStore;
@ -99,7 +98,7 @@ export class IssueRootStore implements IIssueRootStore {
moduleMap: Record<string, IModule> | undefined = undefined;
cycleMap: Record<string, ICycle> | undefined = undefined;
rootStore: RootStore;
rootStore: CoreRootStore;
issues: IIssueStore;
@ -134,7 +133,7 @@ export class IssueRootStore implements IIssueRootStore {
issueKanBanView: IIssueKanBanViewStore;
issueCalendarView: ICalendarStore;
constructor(rootStore: RootStore) {
constructor(rootStore: CoreRootStore) {
makeObservable(this, {
workspaceSlug: observable.ref,
projectId: observable.ref,

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 { CoreRootStore } from "./root.store";
export interface ILabelStore {
//Loaders
@ -55,7 +55,7 @@ export class LabelStore implements ILabelStore {
// services
issueLabelService;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
labelMap: observable,
fetchedMap: observable,

View File

@ -1,8 +1,8 @@
import { action, makeObservable, observable } from "mobx";
// types
import { IUserLite } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// store
import { CoreRootStore } from "../root.store";
import { IProjectMemberStore, ProjectMemberStore } from "./project-member.store";
import { IWorkspaceMemberStore, WorkspaceMemberStore } from "./workspace-member.store";
@ -23,7 +23,7 @@ export class MemberRootStore implements IMemberRootStore {
workspace: IWorkspaceMemberStore;
project: IProjectMemberStore;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// observables
memberMap: observable,

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 { CoreRootStore } from "./root.store";
export interface IModuleStore {
//Loaders
@ -85,7 +85,7 @@ export class ModulesStore implements IModuleStore {
moduleService;
moduleArchiveService;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// observables
loader: observable.ref,

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";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// store
import { CoreRootStore } from "./root.store";
export interface IModuleFilterStore {
// observables
@ -35,9 +35,9 @@ export class ModuleFilterStore implements IModuleFilterStore {
searchQuery: string = "";
archivedModulesSearchQuery: string = "";
// root store
rootStore: RootStore;
rootStore: CoreRootStore;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// observables
displayFilters: observable,

View File

@ -6,12 +6,11 @@ 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 { IPage, Page } from "@/store/pages/page";
import { CoreRootStore } from "../root.store";
type TLoader = "init-loader" | "mutation-loader" | undefined;
@ -51,7 +50,7 @@ export class ProjectPageStore implements IProjectPageStore {
// service
service: ProjectPageService;
constructor(private store: RootStore) {
constructor(private store: CoreRootStore) {
makeObservable(this, {
// observables
loader: observable.ref,

View File

@ -3,10 +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";
// store
import { CoreRootStore } from "./root.store";
export interface IProjectViewStore {
//Loaders
@ -49,7 +49,7 @@ export class ProjectViewStore implements IProjectViewStore {
// services
viewService;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// observables
loader: observable.ref,

View File

@ -1,5 +1,4 @@
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
import { CoreRootStore } from "../root.store";
import { IProjectPublishStore, ProjectPublishStore } from "./project-publish.store";
import { IProjectStore, ProjectStore } from "./project.store";
import { IProjectFilterStore, ProjectFilterStore } from "./project_filter.store";
@ -15,7 +14,7 @@ export class ProjectRootStore {
projectFilter: IProjectFilterStore;
publish: IProjectPublishStore;
constructor(_root: RootStore) {
constructor(_root: CoreRootStore) {
this.project = new ProjectStore(_root);
this.projectFilter = new ProjectFilterStore(_root);
this.publish = new ProjectPublishStore(this);

View File

@ -53,9 +53,12 @@ export class CoreRootStore {
constructor() {
this.router = new RouterStore();
this.commandPalette = new CommandPaletteStore();
this.instance = new InstanceStore();
this.user = new UserStore(this);
this.theme = new ThemeStore();
this.workspaceRoot = new WorkspaceRootStore(this);
this.projectRoot = new ProjectRootStore(this);
this.user = new UserStore(this);
this.memberRoot = new MemberRootStore(this);
this.cycle = new CycleStore(this);
this.cycleFilter = new CycleFilterStore(this);
@ -67,15 +70,10 @@ export class CoreRootStore {
this.state = new StateStore(this);
this.label = new LabelStore(this);
this.dashboard = new DashboardStore(this);
this.commandPalette = new CommandPaletteStore();
this.theme = new ThemeStore(this);
this.eventTracker = new EventTrackerStore(this);
this.instance = new InstanceStore();
this.multipleSelect = new MultipleSelectStore();
// inbox
this.projectInbox = new ProjectInboxStore(this);
this.projectPages = new ProjectPageStore(this);
this.theme = new ThemeStore(this);
this.projectEstimate = new ProjectEstimateStore(this);
}
@ -83,6 +81,10 @@ export class CoreRootStore {
// handling the system theme when user logged out from the app
localStorage.setItem("theme", "system");
this.router = new RouterStore();
this.commandPalette = new CommandPaletteStore();
this.instance = new InstanceStore();
this.user = new UserStore(this);
this.workspaceRoot = new WorkspaceRootStore(this);
this.projectRoot = new ProjectRootStore(this);
this.memberRoot = new MemberRootStore(this);
@ -96,11 +98,7 @@ export class CoreRootStore {
this.state = new StateStore(this);
this.label = new LabelStore(this);
this.dashboard = new DashboardStore(this);
this.router = new RouterStore();
this.commandPalette = new CommandPaletteStore();
this.eventTracker = new EventTrackerStore(this);
this.instance = new InstanceStore();
this.user = new UserStore(this);
this.projectInbox = new ProjectInboxStore(this);
this.projectPages = new ProjectPageStore(this);
this.multipleSelect = new MultipleSelectStore();

View File

@ -6,10 +6,10 @@ import { computedFn } from "mobx-utils";
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";
// plane web store
import { CoreRootStore } from "./root.store";
export interface IStateStore {
//Loaders
@ -52,7 +52,7 @@ export class StateStore implements IStateStore {
router;
stateService;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
// observables
stateMap: observable,

View File

@ -22,7 +22,7 @@ export class ThemeStore implements IThemeStore {
workspaceAnalyticsSidebarCollapsed: boolean | undefined = undefined;
issueDetailSidebarCollapsed: boolean | undefined = undefined;
constructor(private store: RootStore) {
constructor() {
makeObservable(this, {
// observable
sidebarCollapsed: observable.ref,

View File

@ -5,12 +5,11 @@ 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 { CoreRootStore } 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";
@ -56,7 +55,7 @@ export class UserStore implements IUserStore {
userService: UserService;
authService: AuthService;
constructor(private store: RootStore) {
constructor(private store: CoreRootStore) {
// stores
this.userProfile = new ProfileStore(store);
this.userSettings = new UserSettingsStore();

View File

@ -2,10 +2,10 @@ import set from "lodash/set";
import { action, computed, observable, makeObservable, runInAction } from "mobx";
// types
import { IWorkspace } from "@plane/types";
// plane web store
import { RootStore } from "@/plane-web/store/root.store";
// services
import { WorkspaceService } from "@/services/workspace.service";
// store
import { CoreRootStore } from "@/store/root.store";
// sub-stores
import { ApiTokenStore, IApiTokenStore } from "./api-token.store";
import { IWebhookStore, WebhookStore } from "./webhook.store";
@ -44,7 +44,7 @@ export class WorkspaceRootStore implements IWorkspaceRootStore {
webhook: IWebhookStore;
apiToken: IApiTokenStore;
constructor(_rootStore: RootStore) {
constructor(_rootStore: CoreRootStore) {
makeObservable(this, {
loader: observable.ref,
// observables