[WEB-5128] refactor: remove local database dependencies and unused code (#8109)

This commit is contained in:
Prateek Shourya 2025-11-13 18:32:15 +05:30 committed by GitHub
parent 64f90b828b
commit 80670b2b3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 36 additions and 6242 deletions

View file

@ -36,9 +36,7 @@ import { useProjectState } from "@/hooks/store/use-project-state";
import { useProjectView } from "@/hooks/store/use-project-view";
import { useUserPermissions } from "@/hooks/store/user";
import { useTimeLineChart } from "@/hooks/use-timeline-chart";
// local
import { persistence } from "@/local-db/storage.sqlite";
// plane web constants
interface IProjectAuthWrapper {
workspaceSlug: string;
projectId?: string;
@ -86,21 +84,6 @@ export const ProjectAuthWrapper: FC<IProjectAuthWrapper> = observer((props) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useSWR(
workspaceSlug && projectId ? `PROJECT_SYNC_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}` : null,
workspaceSlug && projectId
? () => {
persistence.syncIssues(projectId.toString());
}
: null,
{
revalidateIfStale: true,
revalidateOnFocus: true,
revalidateOnReconnect: true,
refreshInterval: 5 * 60 * 1000,
}
);
// fetching project details
useSWR(
workspaceSlug && projectId ? PROJECT_DETAILS(workspaceSlug.toString(), projectId.toString()) : null,

View file

@ -6,7 +6,6 @@ import Image from "next/image";
import Link from "next/link";
import { useParams } from "next/navigation";
import useSWR from "swr";
import useSWRImmutable from "swr/immutable";
// ui
import { LogOut } from "lucide-react";
import { EUserPermissions, EUserPermissionsLevel } from "@plane/constants";
@ -29,7 +28,6 @@ import {
WORKSPACE_FAVORITE,
WORKSPACE_STATES,
WORKSPACE_SIDEBAR_PREFERENCES,
WORKSPACE_DB,
} from "@/constants/fetch-keys";
import { useFavorite } from "@/hooks/store/use-favorite";
import { useMember } from "@/hooks/store/use-member";
@ -38,8 +36,6 @@ import { useProjectState } from "@/hooks/store/use-project-state";
import { useWorkspace } from "@/hooks/store/use-workspace";
import { useUser, useUserPermissions } from "@/hooks/store/user";
import { usePlatformOS } from "@/hooks/use-platform-os";
// local
import { persistence } from "@/local-db/storage.sqlite";
interface IWorkspaceAuthWrapper {
children: ReactNode;
@ -120,20 +116,6 @@ export const WorkspaceAuthWrapper: FC<IWorkspaceAuthWrapper> = observer((props)
{ revalidateIfStale: false, revalidateOnFocus: false }
);
// initialize the local database
const { isLoading: isDBInitializing } = useSWRImmutable(
workspaceSlug ? WORKSPACE_DB(workspaceSlug.toString()) : null,
workspaceSlug
? async () => {
// persistence.reset();
await persistence.initialize(workspaceSlug.toString());
// Load common data
persistence.syncWorkspace();
return true;
}
: null
);
const handleSignOut = async () => {
await signOut().catch(() =>
setToast({
@ -145,7 +127,7 @@ export const WorkspaceAuthWrapper: FC<IWorkspaceAuthWrapper> = observer((props)
};
// if list of workspaces are not there then we have to render the spinner
if (isParentLoading || allWorkspaces === undefined || loader || isDBInitializing) {
if (isParentLoading || allWorkspaces === undefined || loader) {
return (
<div className="grid h-full place-items-center bg-custom-background-100 p-4 rounded-lg border border-custom-border-200">
<div className="flex flex-col items-center gap-3 text-center">