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

[WEB-2706] chore: Switch to wa-sqlite #5859

Merged
merged 29 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7cea245
fix layout switching when filter is not yet completely fetched
rahulramesha Oct 4, 2024
0ca5509
add layout in issue filter params
rahulramesha Oct 4, 2024
e1746ef
Merge branch 'preview' of github.com:makeplane/plane into fix-local-c…
rahulramesha Oct 4, 2024
84956cd
Handle cases when DB intilization failed
SatishGandham Oct 4, 2024
aeca6f7
chore: permission layer and updated issues v1 query from workspace to…
gurusainath Oct 4, 2024
204ce3a
Merge branch 'fix-local-cache-issues' of gurusainath:makeplane/plane …
gurusainath Oct 4, 2024
28acf5d
- Switch to using wa-sqlite instead of sqlite-wasm
SatishGandham Oct 17, 2024
1b965fc
Merge branch 'fix-local-cache-issues' into use-wa-sqlite
SatishGandham Oct 17, 2024
116b508
Code cleanup and fix indexes
SatishGandham Oct 17, 2024
d821786
Add missing files
SatishGandham Oct 17, 2024
05092cc
- Import only required functions from sentry
SatishGandham Oct 18, 2024
94de2ed
Skip workspace sync if one is already in progress.
SatishGandham Oct 21, 2024
33cadf0
Merge branch 'preview' of https://github.com/makeplane/plane into use…
SatishGandham Oct 21, 2024
7de3066
Sync workspace without using transaction
SatishGandham Oct 21, 2024
6f88af7
Minor cleanup
SatishGandham Oct 22, 2024
5f73c2d
Close DB connection before deleting files
SatishGandham Oct 23, 2024
6c9e4cb
Fix type issue
SatishGandham Oct 23, 2024
99e396b
Improve issue insert performance
SatishGandham Oct 23, 2024
af09cd6
Refactor workspace sync
SatishGandham Oct 23, 2024
75a0a28
Close the DB connection while switching workspaces
SatishGandham Oct 24, 2024
9c04d9f
Merge branch 'preview' into use-wa-sqlite
SatishGandham Oct 24, 2024
3ef93a9
Update web/core/local-db/worker/db.ts
SatishGandham Oct 24, 2024
7401540
Worker cleanup and error handling
SatishGandham Oct 24, 2024
f4bc970
Update web/core/local-db/worker/db.ts
SatishGandham Oct 24, 2024
ed384ea
Update web/core/local-db/storage.sqlite.ts
SatishGandham Oct 24, 2024
faba3e2
Update web/core/local-db/worker/db.ts
SatishGandham Oct 24, 2024
b67c1de
Code cleanup
SatishGandham Oct 24, 2024
e1a3fff
Set default order by to created at and descending
SatishGandham Oct 24, 2024
1a692b9
Wait for transactions to complete.
SatishGandham Oct 24, 2024
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
3 changes: 2 additions & 1 deletion packages/types/src/view-props.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export type TIssueParams =
| "show_empty_groups"
| "cursor"
| "per_page"
| "issue_type";
| "issue_type"
| "layout";
Comment on lines +80 to +81
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using a more specific type for "layout"

While the addition of "layout" to TIssueParams is consistent with its presence in IIssueDisplayFilterOptions, consider using a more specific type instead of a string literal. This could improve type safety and maintainability.

Consider the following changes:

  1. For TIssueParams:
-  | "layout";
+  | "layout" | EIssueLayoutTypes;
  1. For IIssueDisplayFilterOptions:
-  layout?: EIssueLayoutTypes;
+  layout?: TIssueLayouts;

This change would ensure that only valid layout types are used and maintain consistency with the existing TIssueLayouts type.

Also applies to: 107-109


export type TCalendarLayouts = "month" | "week";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useParams } from "next/navigation";
import useSWR from "swr";
// mobx store
// components
import { LogoSpinner } from "@/components/common";
import { ArchivedIssueListLayout, ArchivedIssueAppliedFiltersRoot, IssuePeekOverview } from "@/components/issues";
import { EIssuesStoreType } from "@/constants/issue";
// ui
Expand All @@ -16,7 +17,7 @@ export const ArchivedIssueLayoutRoot: React.FC = observer(() => {
// hooks
const { issuesFilter } = useIssues(EIssuesStoreType.ARCHIVED);

useSWR(
const { isLoading } = useSWR(
workspaceSlug && projectId ? `ARCHIVED_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}` : null,
async () => {
if (workspaceSlug && projectId) {
Expand All @@ -26,7 +27,17 @@ export const ArchivedIssueLayoutRoot: React.FC = observer(() => {
{ revalidateIfStale: false, revalidateOnFocus: false }
);

const issueFilters = issuesFilter?.getIssueFilters(projectId?.toString());

if (!workspaceSlug || !projectId) return <></>;

if (isLoading && !issueFilters)
return (
<div className="h-full w-full flex items-center justify-center">
<LogoSpinner />
</div>
);

return (
<IssuesStoreContext.Provider value={EIssuesStoreType.ARCHIVED}>
<ArchivedIssueAppliedFiltersRoot />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useParams } from "next/navigation";
import useSWR from "swr";
// hooks
// components
import { LogoSpinner } from "@/components/common";
import { TransferIssues, TransferIssuesModal } from "@/components/cycles";
import {
CycleAppliedFiltersRoot,
Expand Down Expand Up @@ -50,7 +51,7 @@ export const CycleLayoutRoot: React.FC = observer(() => {
// state
const [transferIssuesModal, setTransferIssuesModal] = useState(false);

useSWR(
const { isLoading } = useSWR(
workspaceSlug && projectId && cycleId
? `CYCLE_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}_${cycleId.toString()}`
: null,
Expand All @@ -62,7 +63,8 @@ export const CycleLayoutRoot: React.FC = observer(() => {
{ revalidateIfStale: false, revalidateOnFocus: false }
);

const activeLayout = issuesFilter?.issueFilters?.displayFilters?.layout;
const issueFilters = issuesFilter?.getIssueFilters(cycleId?.toString());
const activeLayout = issueFilters?.displayFilters?.layout;

const cycleDetails = cycleId ? getCycleById(cycleId.toString()) : undefined;
const cycleStatus = cycleDetails?.status?.toLocaleLowerCase() ?? "draft";
Expand All @@ -75,6 +77,13 @@ export const CycleLayoutRoot: React.FC = observer(() => {

if (!workspaceSlug || !projectId || !cycleId) return <></>;

if (isLoading && !issueFilters)
return (
<div className="h-full w-full flex items-center justify-center">
<LogoSpinner />
</div>
);

return (
<IssuesStoreContext.Provider value={EIssuesStoreType.CYCLE}>
<TransferIssuesModal handleClose={() => setTransferIssuesModal(false)} isOpen={transferIssuesModal} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { observer } from "mobx-react";
import { useParams } from "next/navigation";
import useSWR from "swr";
import { LogoSpinner } from "@/components/common";
import { IssuePeekOverview } from "@/components/issues/peek-overview";
import { EIssueLayoutTypes, EIssuesStoreType } from "@/constants/issue";
// hooks
Expand Down Expand Up @@ -30,7 +31,7 @@ export const DraftIssueLayoutRoot: React.FC = observer(() => {
// hooks
const { issuesFilter } = useIssues(EIssuesStoreType.DRAFT);

useSWR(
const { isLoading } = useSWR(
workspaceSlug && projectId ? `DRAFT_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}` : null,
async () => {
if (workspaceSlug && projectId) {
Expand All @@ -40,10 +41,18 @@ export const DraftIssueLayoutRoot: React.FC = observer(() => {
{ revalidateIfStale: false, revalidateOnFocus: false }
);

const activeLayout = issuesFilter?.issueFilters?.displayFilters?.layout || undefined;
const issueFilters = issuesFilter?.getIssueFilters(projectId?.toString());
const activeLayout = issueFilters?.displayFilters?.layout || undefined;

if (!workspaceSlug || !projectId) return <></>;

if (isLoading && !issueFilters)
return (
<div className="h-full w-full flex items-center justify-center">
<LogoSpinner />
</div>
);

return (
<IssuesStoreContext.Provider value={EIssuesStoreType.DRAFT}>
<div className="relative flex h-full w-full flex-col overflow-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useSWR from "swr";
// mobx store
// components
import { Row, ERowVariant } from "@plane/ui";
import { LogoSpinner } from "@/components/common";
import {
IssuePeekOverview,
ModuleAppliedFiltersRoot,
Expand Down Expand Up @@ -43,7 +44,7 @@ export const ModuleLayoutRoot: React.FC = observer(() => {
// hooks
const { issuesFilter } = useIssues(EIssuesStoreType.MODULE);

useSWR(
const { isLoading } = useSWR(
workspaceSlug && projectId && moduleId
? `MODULE_ISSUES_${workspaceSlug.toString()}_${projectId.toString()}_${moduleId.toString()}`
: null,
Expand All @@ -55,9 +56,18 @@ export const ModuleLayoutRoot: React.FC = observer(() => {
{ revalidateIfStale: false, revalidateOnFocus: false }
);

const issueFilters = issuesFilter?.getIssueFilters(moduleId?.toString());

if (!workspaceSlug || !projectId || !moduleId) return <></>;

const activeLayout = issuesFilter?.issueFilters?.displayFilters?.layout || undefined;
if (isLoading && !issueFilters)
return (
<div className="h-full w-full flex items-center justify-center">
<LogoSpinner />
</div>
);

const activeLayout = issueFilters?.displayFilters?.layout || undefined;

return (
<IssuesStoreContext.Provider value={EIssuesStoreType.MODULE}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useParams } from "next/navigation";
import useSWR from "swr";
// components
import { Spinner } from "@plane/ui";
import { LogoSpinner } from "@/components/common";
import {
ListLayout,
CalendarLayout,
Expand Down Expand Up @@ -44,7 +45,7 @@ export const ProjectLayoutRoot: FC = observer(() => {
// hooks
const { issues, issuesFilter } = useIssues(EIssuesStoreType.PROJECT);

useSWR(
const { isLoading } = useSWR(
workspaceSlug && projectId ? `PROJECT_ISSUES_${workspaceSlug}_${projectId}` : null,
async () => {
if (workspaceSlug && projectId) {
Expand All @@ -54,10 +55,18 @@ export const ProjectLayoutRoot: FC = observer(() => {
{ revalidateIfStale: false, revalidateOnFocus: false }
);

const activeLayout = issuesFilter?.issueFilters?.displayFilters?.layout;
const issueFilters = issuesFilter?.getIssueFilters(projectId?.toString());
const activeLayout = issueFilters?.displayFilters?.layout;

if (!workspaceSlug || !projectId) return <></>;

if (isLoading && !issueFilters)
return (
<div className="h-full w-full flex items-center justify-center">
<LogoSpinner />
</div>
);

return (
<IssuesStoreContext.Provider value={EIssuesStoreType.PROJECT}>
<div className="relative flex h-full w-full flex-col overflow-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ export const ProjectViewLayoutRoot: React.FC = observer(() => {
{ revalidateIfStale: false, revalidateOnFocus: false }
);

const activeLayout = issuesFilter?.issueFilters?.displayFilters?.layout;
const issueFilters = issuesFilter?.getIssueFilters(viewId?.toString());
const activeLayout = issueFilters?.displayFilters?.layout;

if (!workspaceSlug || !projectId || !viewId) return <></>;

if (isLoading) {
if (isLoading && !issueFilters) {
return (
<div className="relative flex h-screen w-full items-center justify-center">
<LogoSpinner />
Expand Down
Loading
Loading