Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve dev server performance #5962

Draft
wants to merge 7 commits into
base: preview
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion web/app/[workspaceSlug]/(projects)/notifications/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@

import { useCallback, useEffect } from "react";
import { observer } from "mobx-react";
import dynamic from "next/dynamic";
import { useParams } from "next/navigation";
import useSWR from "swr";
// components
import { LogoSpinner } from "@/components/common";
import { PageHead } from "@/components/core";
import { EmptyState } from "@/components/empty-state";
import { InboxContentRoot } from "@/components/inbox";
import { IssuePeekOverview } from "@/components/issues";
// constants
import { EmptyStateType } from "@/constants/empty-state";
import { ENotificationLoader, ENotificationQueryParamType } from "@/constants/notification";
// hooks
import { useIssueDetail, useUserPermissions, useWorkspace, useWorkspaceNotifications } from "@/hooks/store";
import { useWorkspaceIssueProperties } from "@/hooks/use-workspace-issue-properties";

const IssuePeekOverview = dynamic(
() => import("@/components/issues/peek-overview/root").then((m) => m.IssuePeekOverview),
{
ssr: false,
loading: () => null,
}
);

const WorkspaceDashboardPage = observer(() => {
const { workspaceSlug } = useParams();
// hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Head from "next/head";
import { useParams } from "next/navigation";
// components
import { PageHead } from "@/components/core";
import { ProjectLayoutRoot } from "@/components/issues";
import { ProjectLayoutRoot } from "@/components/issues/issue-layouts";
// hooks
import { useProject } from "@/hooks/store";

Expand Down
18 changes: 17 additions & 1 deletion web/core/components/analytics/project-modal/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from "react";
import { observer } from "mobx-react";
import dynamic from "next/dynamic";
import { Dialog, Transition } from "@headlessui/react";
import { ICycle, IModule, IProject } from "@plane/types";

// components
import { ProjectAnalyticsModalHeader, ProjectAnalyticsModalMainContent } from "@/components/analytics";
// types

type Props = {
Expand All @@ -15,6 +15,22 @@ type Props = {
projectDetails?: IProject | undefined;
};

const ProjectAnalyticsModalHeader = dynamic(
() => import("@/components/analytics").then((m) => m.ProjectAnalyticsModalHeader),
{
ssr: false,
loading: () => null,
}
);

const ProjectAnalyticsModalMainContent = dynamic(
() => import("@/components/analytics").then((m) => m.ProjectAnalyticsModalMainContent),
{
ssr: false,
loading: () => null,
}
);

export const ProjectAnalyticsModal: React.FC<Props> = observer((props) => {
const { isOpen, onClose, cycleDetails, moduleDetails, projectDetails } = props;

Expand Down
7 changes: 5 additions & 2 deletions web/core/components/cycles/cycles-view.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FC } from "react";
import { observer } from "mobx-react";
import dynamic from "next/dynamic";
import Image from "next/image";
// components
import { CyclesList } from "@/components/cycles";
// ui
import { CycleModuleListLayout } from "@/components/ui";
// hooks
Expand All @@ -15,7 +15,10 @@ export interface ICyclesView {
workspaceSlug: string;
projectId: string;
}

const CyclesList = dynamic(() => import("@/components/cycles/list/root").then((m) => m.CyclesList), {
ssr: false,
loading: () => <CycleModuleListLayout />,
});
export const CyclesView: FC<ICyclesView> = observer((props) => {
const { workspaceSlug, projectId } = props;
// store hooks
Expand Down
20 changes: 18 additions & 2 deletions web/core/components/inbox/content/root.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
import { FC, useEffect, useState } from "react";
import { observer } from "mobx-react";
import { FC, useEffect, useState } from "react";
import useSWR from "swr";
import { TNameDescriptionLoader } from "@plane/types";
// components
import { ContentWrapper } from "@plane/ui";
import { InboxIssueActionsHeader, InboxIssueMainContent } from "@/components/inbox";
// hooks
import { useProjectInbox, useUser, useUserPermissions } from "@/hooks/store";
import { useAppRouter } from "@/hooks/use-app-router";
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
import dynamic from "next/dynamic";
import { LogoSpinner } from "@/components/common";

const InboxIssueActionsHeader = dynamic(
() => import("@/components/inbox/content/inbox-issue-header").then((m) => m.InboxIssueActionsHeader),
{
ssr: false,
loading: () => <LogoSpinner />,
}
);
const InboxIssueMainContent = dynamic(
() => import("@/components/inbox/content/issue-root").then((m) => m.InboxIssueMainContent),
{
ssr: false,
loading: () => <LogoSpinner />,
}
);

type TInboxContentRoot = {
workspaceSlug: string;
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/issues/filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { isIssueFilterActive } from "@/helpers/filter.helper";
import { useLabel, useProjectState, useMember, useIssues } from "@/hooks/store";
// plane web types
import { TProject } from "@/plane-web/types";
import { ProjectAnalyticsModal } from "@/components/analytics";
// local components
import { ProjectAnalyticsModal } from "../analytics";

type Props = {
currentProjectDetails: TProject | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,73 @@

import { FC, Fragment } from "react";
import { observer } from "mobx-react";
import dynamic from "next/dynamic";
import { useParams } from "next/navigation";
import useSWR from "swr";
// components
import { Spinner } from "@plane/ui";
import { LogoSpinner } from "@/components/common";
import {
ListLayout,
CalendarLayout,
BaseGanttRoot,
KanBanLayout,
ProjectAppliedFiltersRoot,
ProjectSpreadsheetLayout,
IssuePeekOverview,
} from "@/components/issues";

// constants
import {
CalendarLayoutLoader,
GanttLayoutLoader,
KanbanLayoutLoader,
ListLayoutLoader,
SpreadsheetLayoutLoader,
} from "@/components/ui";
import { EIssueLayoutTypes, EIssuesStoreType } from "@/constants/issue";
// hooks
import { useIssues } from "@/hooks/store";
import { IssuesStoreContext } from "@/hooks/use-issue-layout-store";

const ProjectAppliedFiltersRoot = dynamic(
() =>
import("@/components/issues/issue-layouts/filters/applied-filters/roots/project-root").then(
(m) => m.ProjectAppliedFiltersRoot
),
{
ssr: false,
loading: () => null,
}
);
const ListLayout = dynamic(
() => import("@/components/issues/issue-layouts/list/roots/project-root").then((m) => m.ListLayout),
{
ssr: false,
loading: () => <ListLayoutLoader />,
}
);
const KanBanLayout = dynamic(
() => import("@/components/issues/issue-layouts/kanban/roots/project-root").then((m) => m.KanBanLayout),
{
ssr: false,
loading: () => <KanbanLayoutLoader />,
}
);
const CalendarLayout = dynamic(
() => import("@/components/issues/issue-layouts/calendar/roots/project-root").then((m) => m.CalendarLayout),
{
ssr: false,
loading: () => <CalendarLayoutLoader />,
}
);
const BaseGanttRoot = dynamic(
() => import("@/components/issues/issue-layouts/gantt/base-gantt-root").then((m) => m.BaseGanttRoot),
{
ssr: false,
loading: () => <GanttLayoutLoader />,
}
);
const ProjectSpreadsheetLayout = dynamic(
() =>
import("@/components/issues/issue-layouts/spreadsheet/roots/project-root").then((m) => m.ProjectSpreadsheetLayout),
{
ssr: false,
loading: () => <SpreadsheetLayoutLoader />,
}
);

const ProjectIssueLayout = (props: { activeLayout: EIssueLayoutTypes | undefined }) => {
switch (props.activeLayout) {
case EIssueLayoutTypes.LIST:
Expand All @@ -38,6 +85,13 @@ const ProjectIssueLayout = (props: { activeLayout: EIssueLayoutTypes | undefined
return null;
}
};
const IssuePeekOverview = dynamic(
() => import("@/components/issues/peek-overview/root").then((m) => m.IssuePeekOverview),
{
ssr: false,
loading: () => null,
}
);

export const ProjectLayoutRoot: FC = observer(() => {
// router
Expand Down
23 changes: 20 additions & 3 deletions web/core/components/page-views/workspace-dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { useEffect } from "react";
import { observer } from "mobx-react";
import dynamic from "next/dynamic";
import { useParams } from "next/navigation";
// components
import { ContentWrapper } from "@plane/ui";
import { DashboardWidgets } from "@/components/dashboard";
// import { DashboardWidgets } from "@/components/dashboard";
import { LogoSpinner } from "@/components/common";
import { EmptyState } from "@/components/empty-state";
import { IssuePeekOverview } from "@/components/issues";
// import { IssuePeekOverview } from "@/components/issues";
import { TourRoot } from "@/components/onboarding";
import { UserGreetingsView } from "@/components/user";
// constants
Expand All @@ -14,9 +16,24 @@ import { PRODUCT_TOUR_COMPLETED } from "@/constants/event-tracker";
// helpers
import { cn } from "@/helpers/common.helper";
// hooks
import { useCommandPalette, useUserProfile, useEventTracker, useDashboard, useProject, useUser } from "@/hooks/store";
import { useCommandPalette, useDashboard, useEventTracker, useProject, useUser, useUserProfile } from "@/hooks/store";
import useSize from "@/hooks/use-window-size";

const DashboardWidgets = dynamic(
() => import("@/components/dashboard/home-dashboard-widgets").then((m) => m.DashboardWidgets),
{
ssr: false,
loading: () => <LogoSpinner />,
}
);
const IssuePeekOverview = dynamic(
() => import("@/components/issues/peek-overview/root").then((m) => m.IssuePeekOverview),
{
ssr: false,
loading: () => null,
}
);

export const WorkspaceDashboardView = observer(() => {
// store hooks
const {
Expand Down
9 changes: 8 additions & 1 deletion web/core/components/pages/editor/header/options-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { EditorReadOnlyRefApi, EditorRefApi } from "@plane/editor";
// ui
import { ArchiveIcon, CustomMenu, type ISvgIcons, TOAST_TYPE, ToggleSwitch, setToast } from "@plane/ui";
// components
import { ExportPageModal } from "@/components/pages";
// helpers
import { copyTextToClipboard, copyUrlToClipboard } from "@/helpers/string.helper";
// hooks
Expand All @@ -28,13 +27,21 @@ import { usePageFilters } from "@/hooks/use-page-filters";
import { useQueryParams } from "@/hooks/use-query-params";
// store
import { IPage } from "@/store/pages/page";
import dynamic from "next/dynamic";

type Props = {
editorRef: EditorRefApi | EditorReadOnlyRefApi | null;
handleDuplicatePage: () => void;
page: IPage;
};

const ExportPageModal = dynamic(
() => import("@/components/pages/modals/export-page-modal").then((m) => m.ExportPageModal),
{
ssr: false,
loading: () => null,
}
);
export const PageOptionsDropdown: React.FC<Props> = observer((props) => {
const { editorRef, handleDuplicatePage, page } = props;
// router
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";
import React, { FC } from "react";
// helpers
import { SidebarHamburgerToggle } from "@/components/core";
import { cn } from "@/helpers/common.helper";
import { SidebarHamburgerToggle } from "../core";

type Props = {
children: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { forwardRef } from "react";
import range from "lodash/range";
import { cn } from "@plane/editor";
import { ContentWrapper } from "@plane/ui";
import { cn } from "@/helpers/common.helper";

export const KanbanIssueBlockLoader = forwardRef<HTMLSpanElement, { cardHeight?: number; shouldAnimate?: boolean }>(
({ cardHeight = 100, shouldAnimate = true }, ref) => (
Expand Down
2 changes: 1 addition & 1 deletion web/core/hooks/use-workspace-issue-properties.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCycle, useLabel, useModule, useProjectEstimates, useProjectState } from "@/hooks/store";
import useSWR from "swr";
import { useCycle, useProjectEstimates, useLabel, useModule, useProjectState } from "./store";

export const useWorkspaceIssueProperties = (workspaceSlug: string | string[] | undefined) => {
const { fetchWorkspaceLabels } = useLabel();
Expand Down
Loading