[WEB-2001] fix: Issue local cache fixes (#5703)
* Fix sync of local updates * Escape single quotes!! * Fix last updated time query * Move console.logs out * Fix issue title not rendering line breaks when disabled * Add a todo * Fix build errors * Disable local
This commit is contained in:
parent
6e0ece496a
commit
f3340749e8
11 changed files with 48 additions and 42 deletions
|
|
@ -100,7 +100,7 @@ export const IssueTitleInput: FC<IssueTitleInputProps> = observer((props) => {
|
||||||
[setIsSubmitting]
|
[setIsSubmitting]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (disabled) return <div className="text-2xl font-medium">{title}</div>;
|
if (disabled) return <div className="text-2xl font-medium whitespace-pre-line">{title}</div>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-1.5">
|
<div className="flex flex-col gap-1.5">
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import { loadWorkSpaceData } from "./utils/load-workspace";
|
||||||
import { issueFilterCountQueryConstructor, issueFilterQueryConstructor } from "./utils/query-constructor";
|
import { issueFilterCountQueryConstructor, issueFilterQueryConstructor } from "./utils/query-constructor";
|
||||||
import { runQuery } from "./utils/query-executor";
|
import { runQuery } from "./utils/query-executor";
|
||||||
import { createTables } from "./utils/tables";
|
import { createTables } from "./utils/tables";
|
||||||
import { getGroupedIssueResults, getSubGroupedIssueResults } from "./utils/utils";
|
import { logError, getGroupedIssueResults, getSubGroupedIssueResults, logInfo, log } from "./utils/utils";
|
||||||
|
|
||||||
declare module "@sqlite.org/sqlite-wasm" {
|
declare module "@sqlite.org/sqlite-wasm" {
|
||||||
export function sqlite3Worker1Promiser(...args: any): any;
|
export function sqlite3Worker1Promiser(...args: any): any;
|
||||||
|
|
@ -24,9 +24,6 @@ declare module "@sqlite.org/sqlite-wasm" {
|
||||||
const DB_VERSION = 1;
|
const DB_VERSION = 1;
|
||||||
const PAGE_SIZE = 1000;
|
const PAGE_SIZE = 1000;
|
||||||
const BATCH_SIZE = 200;
|
const BATCH_SIZE = 200;
|
||||||
const log = console.log;
|
|
||||||
const error = console.error;
|
|
||||||
const info = console.info;
|
|
||||||
|
|
||||||
type TProjectStatus = {
|
type TProjectStatus = {
|
||||||
issues: { status: undefined | "loading" | "ready" | "error" | "syncing"; sync: Promise<void> | undefined };
|
issues: { status: undefined | "loading" | "ready" | "error" | "syncing"; sync: Promise<void> | undefined };
|
||||||
|
|
@ -72,7 +69,7 @@ export class Storage {
|
||||||
await this._initialize(workspaceSlug);
|
await this._initialize(workspaceSlug);
|
||||||
return true;
|
return true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error(err);
|
logError(err);
|
||||||
this.status = "error";
|
this.status = "error";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +89,7 @@ export class Storage {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
info("Loading and initializing SQLite3 module...");
|
logInfo("Loading and initializing SQLite3 module...");
|
||||||
|
|
||||||
this.workspaceSlug = workspaceSlug;
|
this.workspaceSlug = workspaceSlug;
|
||||||
this.dbName = workspaceSlug;
|
this.dbName = workspaceSlug;
|
||||||
|
|
@ -141,7 +138,7 @@ export class Storage {
|
||||||
|
|
||||||
await this.setOption("DB_VERSION", DB_VERSION.toString());
|
await this.setOption("DB_VERSION", DB_VERSION.toString());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error(err);
|
logError(err);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,15 +176,16 @@ export class Storage {
|
||||||
this.setSync(projectId, sync);
|
this.setSync(projectId, sync);
|
||||||
await sync;
|
await sync;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
logError(e);
|
||||||
this.setStatus(projectId, "error");
|
this.setStatus(projectId, "error");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_syncIssues = async (projectId: string) => {
|
_syncIssues = async (projectId: string) => {
|
||||||
console.log("### Sync started");
|
log("### Sync started");
|
||||||
let status = this.getStatus(projectId);
|
let status = this.getStatus(projectId);
|
||||||
if (status === "loading" || status === "syncing") {
|
if (status === "loading" || status === "syncing") {
|
||||||
info(`Project ${projectId} is already loading or syncing`);
|
logInfo(`Project ${projectId} is already loading or syncing`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const syncPromise = this.getSync(projectId);
|
const syncPromise = this.getSync(projectId);
|
||||||
|
|
@ -235,7 +233,7 @@ export class Storage {
|
||||||
if (syncedAt) {
|
if (syncedAt) {
|
||||||
await syncDeletesToLocal(this.workspaceSlug, projectId, { updated_at__gt: syncedAt });
|
await syncDeletesToLocal(this.workspaceSlug, projectId, { updated_at__gt: syncedAt });
|
||||||
}
|
}
|
||||||
console.log("### Time taken to add issues", performance.now() - start);
|
log("### Time taken to add issues", performance.now() - start);
|
||||||
|
|
||||||
if (status === "loading") {
|
if (status === "loading") {
|
||||||
await createIndexes();
|
await createIndexes();
|
||||||
|
|
@ -252,7 +250,7 @@ export class Storage {
|
||||||
|
|
||||||
getLastUpdatedIssue = async (projectId: string) => {
|
getLastUpdatedIssue = async (projectId: string) => {
|
||||||
const lastUpdatedIssue = await runQuery(
|
const lastUpdatedIssue = await runQuery(
|
||||||
`select id, name, updated_at , sequence_id from issues where project_id='${projectId}' order by datetime(updated_at) desc limit 1`
|
`select id, name, updated_at , sequence_id from issues WHERE project_id='${projectId}' AND is_local_update IS NULL order by datetime(updated_at) desc limit 1 `
|
||||||
);
|
);
|
||||||
|
|
||||||
if (lastUpdatedIssue.length) {
|
if (lastUpdatedIssue.length) {
|
||||||
|
|
@ -270,7 +268,7 @@ export class Storage {
|
||||||
};
|
};
|
||||||
|
|
||||||
getIssues = async (workspaceSlug: string, projectId: string, queries: any, config: any) => {
|
getIssues = async (workspaceSlug: string, projectId: string, queries: any, config: any) => {
|
||||||
console.log("#### Queries", queries);
|
log("#### Queries", queries);
|
||||||
|
|
||||||
const currentProjectStatus = this.getStatus(projectId);
|
const currentProjectStatus = this.getStatus(projectId);
|
||||||
if (
|
if (
|
||||||
|
|
@ -280,7 +278,7 @@ export class Storage {
|
||||||
currentProjectStatus === "error" ||
|
currentProjectStatus === "error" ||
|
||||||
!rootStore.user.localDBEnabled
|
!rootStore.user.localDBEnabled
|
||||||
) {
|
) {
|
||||||
info(`Project ${projectId} is loading, falling back to server`);
|
logInfo(`Project ${projectId} is loading, falling back to server`);
|
||||||
const issueService = new IssueService();
|
const issueService = new IssueService();
|
||||||
return await issueService.getIssuesFromServer(workspaceSlug, projectId, queries);
|
return await issueService.getIssuesFromServer(workspaceSlug, projectId, queries);
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +305,7 @@ export class Storage {
|
||||||
const parsingStart = performance.now();
|
const parsingStart = performance.now();
|
||||||
let issueResults = issuesRaw.map((issue: any) => formatLocalIssue(issue));
|
let issueResults = issuesRaw.map((issue: any) => formatLocalIssue(issue));
|
||||||
|
|
||||||
console.log("#### Issue Results", issueResults.length);
|
log("#### Issue Results", issueResults.length);
|
||||||
|
|
||||||
const parsingEnd = performance.now();
|
const parsingEnd = performance.now();
|
||||||
|
|
||||||
|
|
@ -326,7 +324,7 @@ export class Storage {
|
||||||
Parsing: parsingEnd - parsingStart,
|
Parsing: parsingEnd - parsingStart,
|
||||||
Grouping: groupingEnd - grouping,
|
Grouping: groupingEnd - grouping,
|
||||||
};
|
};
|
||||||
console.log(issueResults);
|
log(issueResults);
|
||||||
console.table(times);
|
console.table(times);
|
||||||
|
|
||||||
const total_pages = Math.ceil(total_count / Number(pageSize));
|
const total_pages = Math.ceil(total_count / Number(pageSize));
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ export const deleteIssueFromLocal = async (issue_id: any) => {
|
||||||
persistence.db.exec(deleteMetaQuery);
|
persistence.db.exec(deleteMetaQuery);
|
||||||
persistence.db.exec("COMMIT;");
|
persistence.db.exec("COMMIT;");
|
||||||
};
|
};
|
||||||
|
// @todo: Update deletes the issue description from local. Implement a separate update.
|
||||||
export const updateIssue = async (issue: TIssue) => {
|
export const updateIssue = async (issue: TIssue & { is_local_update: number }) => {
|
||||||
if (document.hidden || !rootStore.user.localDBEnabled) return;
|
if (document.hidden || !rootStore.user.localDBEnabled) return;
|
||||||
|
|
||||||
const issue_id = issue.id;
|
const issue_id = issue.id;
|
||||||
|
|
@ -82,10 +82,10 @@ const stageIssueInserts = (issue: any) => {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (typeof value === "object") {
|
if (typeof value === "object") {
|
||||||
return `'${JSON.stringify(value)}'`;
|
return `'${JSON.stringify(value).replace(/'/g, "''")}'`;
|
||||||
}
|
}
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
return `'${value}'`;
|
return `'${value.replace(/'/g, "''")}'`;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import {
|
||||||
singleFilterConstructor,
|
singleFilterConstructor,
|
||||||
translateQueryParams,
|
translateQueryParams,
|
||||||
} from "./query.utils";
|
} from "./query.utils";
|
||||||
|
import { log } from "./utils";
|
||||||
export const SPECIAL_ORDER_BY = {
|
export const SPECIAL_ORDER_BY = {
|
||||||
labels__name: "labels",
|
labels__name: "labels",
|
||||||
"-labels__name": "labels",
|
"-labels__name": "labels",
|
||||||
|
|
@ -47,7 +48,7 @@ export const issueFilterQueryConstructor = (workspaceSlug: string, projectId: st
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
console.log("###", sql);
|
log("###", sql);
|
||||||
|
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +64,7 @@ export const issueFilterQueryConstructor = (workspaceSlug: string, projectId: st
|
||||||
WHERE rank <= ${per_page}
|
WHERE rank <= ${per_page}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
console.log("###", sql);
|
log("###", sql);
|
||||||
|
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
@ -119,7 +120,7 @@ export const issueFilterQueryConstructor = (workspaceSlug: string, projectId: st
|
||||||
`;
|
`;
|
||||||
sql += ` group by i.id ${orderByString} LIMIT ${pageSize} OFFSET ${offset * 1 + page * pageSize};`;
|
sql += ` group by i.id ${orderByString} LIMIT ${pageSize} OFFSET ${offset * 1 + page * pageSize};`;
|
||||||
|
|
||||||
console.log("######$$$", sql);
|
log("######$$$", sql);
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,7 +149,7 @@ export const issueFilterQueryConstructor = (workspaceSlug: string, projectId: st
|
||||||
// Add offset and paging to query
|
// Add offset and paging to query
|
||||||
sql += ` LIMIT ${pageSize} OFFSET ${offset * 1 + page * pageSize};`;
|
sql += ` LIMIT ${pageSize} OFFSET ${offset * 1 + page * pageSize};`;
|
||||||
|
|
||||||
console.log("$$$", sql);
|
log("$$$", sql);
|
||||||
return sql;
|
return sql;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ export const issueSchema: Schema = {
|
||||||
assignee_ids: "TEXT",
|
assignee_ids: "TEXT",
|
||||||
module_ids: "TEXT",
|
module_ids: "TEXT",
|
||||||
description_html: "TEXT",
|
description_html: "TEXT",
|
||||||
|
is_local_update: "INTEGER",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const issueMetaSchema: Schema = {
|
export const issueMetaSchema: Schema = {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import {
|
||||||
memberSchema,
|
memberSchema,
|
||||||
optionsSchema,
|
optionsSchema,
|
||||||
} from "./schemas";
|
} from "./schemas";
|
||||||
|
import { log } from "./utils";
|
||||||
|
|
||||||
const createTableSQLfromSchema = (tableName: string, schema: Schema) => {
|
const createTableSQLfromSchema = (tableName: string, schema: Schema) => {
|
||||||
let sql = `CREATE TABLE IF NOT EXISTS ${tableName} (`;
|
let sql = `CREATE TABLE IF NOT EXISTS ${tableName} (`;
|
||||||
|
|
@ -18,7 +19,7 @@ const createTableSQLfromSchema = (tableName: string, schema: Schema) => {
|
||||||
.map((key) => `'${key}' ${schema[key]}`)
|
.map((key) => `'${key}' ${schema[key]}`)
|
||||||
.join(", ");
|
.join(", ");
|
||||||
sql += `);`;
|
sql += `);`;
|
||||||
console.log("#####", sql);
|
log("#####", sql);
|
||||||
return sql;
|
return sql;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,13 @@ import { TIssue } from "@plane/types";
|
||||||
import { rootStore } from "@/lib/store-context";
|
import { rootStore } from "@/lib/store-context";
|
||||||
import { updateIssue } from "./load-issues";
|
import { updateIssue } from "./load-issues";
|
||||||
|
|
||||||
export const log = console.log;
|
export const log = (...args: any) => {
|
||||||
|
if ((window as any).DEBUG) {
|
||||||
// export const log = () => {};
|
console.log(...args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export const logError = console.error;
|
||||||
|
export const logInfo = console.info;
|
||||||
|
|
||||||
export const updatePersistentLayer = async (issueIds: string | string[]) => {
|
export const updatePersistentLayer = async (issueIds: string | string[]) => {
|
||||||
if (typeof issueIds === "string") {
|
if (typeof issueIds === "string") {
|
||||||
|
|
@ -44,7 +48,7 @@ export const updatePersistentLayer = async (issueIds: string | string[]) => {
|
||||||
"module_ids",
|
"module_ids",
|
||||||
"type_id",
|
"type_id",
|
||||||
]);
|
]);
|
||||||
updateIssue(issuePartial);
|
updateIssue({ ...issuePartial, is_local_update: 1 });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import { persistence } from "@/local-db/storage.sqlite";
|
||||||
// services
|
// services
|
||||||
|
|
||||||
import { addIssue, addIssuesBulk, deleteIssueFromLocal } from "@/local-db/utils/load-issues";
|
import { addIssue, addIssuesBulk, deleteIssueFromLocal } from "@/local-db/utils/load-issues";
|
||||||
import { updatePersistentLayer } from "@/local-db/utils/utils";
|
|
||||||
import { APIService } from "@/services/api.service";
|
import { APIService } from "@/services/api.service";
|
||||||
|
|
||||||
export class IssueService extends APIService {
|
export class IssueService extends APIService {
|
||||||
|
|
@ -24,10 +23,7 @@ export class IssueService extends APIService {
|
||||||
|
|
||||||
async createIssue(workspaceSlug: string, projectId: string, data: Partial<TIssue>): Promise<TIssue> {
|
async createIssue(workspaceSlug: string, projectId: string, data: Partial<TIssue>): Promise<TIssue> {
|
||||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/`, data)
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/`, data)
|
||||||
.then((response) => {
|
.then((response) => response?.data)
|
||||||
updatePersistentLayer(response?.data?.id);
|
|
||||||
return response?.data;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
});
|
});
|
||||||
|
|
@ -147,7 +143,6 @@ export class IssueService extends APIService {
|
||||||
issues: string[];
|
issues: string[];
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
updatePersistentLayer(data.issues);
|
|
||||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`, data)
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`, data)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
@ -177,7 +172,6 @@ export class IssueService extends APIService {
|
||||||
relation?: "blocking" | null;
|
relation?: "blocking" | null;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
updatePersistentLayer(issueId);
|
|
||||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/`, data)
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/`, data)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
@ -218,7 +212,6 @@ export class IssueService extends APIService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async patchIssue(workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>): Promise<any> {
|
async patchIssue(workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssue>): Promise<any> {
|
||||||
updatePersistentLayer(issueId);
|
|
||||||
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/`, data)
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/`, data)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
@ -249,7 +242,6 @@ export class IssueService extends APIService {
|
||||||
issueId: string,
|
issueId: string,
|
||||||
data: { sub_issue_ids: string[] }
|
data: { sub_issue_ids: string[] }
|
||||||
): Promise<TIssueSubIssues> {
|
): Promise<TIssueSubIssues> {
|
||||||
updatePersistentLayer([issueId, ...data.sub_issue_ids]);
|
|
||||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`, data)
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`, data)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
@ -271,7 +263,6 @@ export class IssueService extends APIService {
|
||||||
issueId: string,
|
issueId: string,
|
||||||
data: Partial<TIssueLink>
|
data: Partial<TIssueLink>
|
||||||
): Promise<TIssueLink> {
|
): Promise<TIssueLink> {
|
||||||
updatePersistentLayer(issueId);
|
|
||||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/`, data)
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/`, data)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
@ -286,7 +277,6 @@ export class IssueService extends APIService {
|
||||||
linkId: string,
|
linkId: string,
|
||||||
data: Partial<TIssueLink>
|
data: Partial<TIssueLink>
|
||||||
): Promise<TIssueLink> {
|
): Promise<TIssueLink> {
|
||||||
updatePersistentLayer(issueId);
|
|
||||||
return this.patch(
|
return this.patch(
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`,
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`,
|
||||||
data
|
data
|
||||||
|
|
@ -298,7 +288,6 @@ export class IssueService extends APIService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteIssueLink(workspaceSlug: string, projectId: string, issueId: string, linkId: string): Promise<any> {
|
async deleteIssueLink(workspaceSlug: string, projectId: string, issueId: string, linkId: string): Promise<any> {
|
||||||
updatePersistentLayer(issueId);
|
|
||||||
return this.delete(
|
return this.delete(
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import {
|
||||||
} from "@plane/types";
|
} from "@plane/types";
|
||||||
import { EIssueLayoutTypes, ISSUE_PRIORITIES } from "@/constants/issue";
|
import { EIssueLayoutTypes, ISSUE_PRIORITIES } from "@/constants/issue";
|
||||||
import { convertToISODateString } from "@/helpers/date-time.helper";
|
import { convertToISODateString } from "@/helpers/date-time.helper";
|
||||||
|
import { updatePersistentLayer } from "@/local-db/utils/utils";
|
||||||
import { CycleService } from "@/services/cycle.service";
|
import { CycleService } from "@/services/cycle.service";
|
||||||
import { IssueArchiveService, IssueDraftService, IssueService } from "@/services/issue";
|
import { IssueArchiveService, IssueDraftService, IssueService } from "@/services/issue";
|
||||||
import { ModuleService } from "@/services/module.service";
|
import { ModuleService } from "@/services/module.service";
|
||||||
|
|
@ -529,6 +530,8 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
||||||
// If shouldUpdateList is true, call fetchParentStats
|
// If shouldUpdateList is true, call fetchParentStats
|
||||||
shouldUpdateList && (await this.fetchParentStats(workspaceSlug, projectId));
|
shouldUpdateList && (await this.fetchParentStats(workspaceSlug, projectId));
|
||||||
|
|
||||||
|
updatePersistentLayer(response.id);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import {
|
||||||
TSubIssuesStateDistribution,
|
TSubIssuesStateDistribution,
|
||||||
} from "@plane/types";
|
} from "@plane/types";
|
||||||
// services
|
// services
|
||||||
|
import { updatePersistentLayer } from "@/local-db/utils/utils";
|
||||||
import { IssueService } from "@/services/issue";
|
import { IssueService } from "@/services/issue";
|
||||||
// store
|
// store
|
||||||
import { IIssueDetail } from "./root.store";
|
import { IIssueDetail } from "./root.store";
|
||||||
|
|
@ -180,6 +181,7 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
||||||
[parentIssueId, "sub_issues_count"],
|
[parentIssueId, "sub_issues_count"],
|
||||||
this.subIssues[parentIssueId].length
|
this.subIssues[parentIssueId].length
|
||||||
);
|
);
|
||||||
|
updatePersistentLayer([parentIssueId, ...issueIds]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
@ -277,6 +279,8 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updatePersistentLayer([parentIssueId]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -310,6 +314,8 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updatePersistentLayer([parentIssueId]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import isEmpty from "lodash/isEmpty";
|
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
import update from "lodash/update";
|
import update from "lodash/update";
|
||||||
import { action, makeObservable, observable, runInAction } from "mobx";
|
import { action, makeObservable, observable, runInAction } from "mobx";
|
||||||
|
|
@ -8,6 +7,8 @@ import { TIssue } from "@plane/types";
|
||||||
// helpers
|
// helpers
|
||||||
import { getCurrentDateTimeInISO } from "@/helpers/date-time.helper";
|
import { getCurrentDateTimeInISO } from "@/helpers/date-time.helper";
|
||||||
// services
|
// services
|
||||||
|
import { deleteIssueFromLocal } from "@/local-db/utils/load-issues";
|
||||||
|
import { updatePersistentLayer } from "@/local-db/utils/utils";
|
||||||
import { IssueService } from "@/services/issue";
|
import { IssueService } from "@/services/issue";
|
||||||
|
|
||||||
export type IIssueStore = {
|
export type IIssueStore = {
|
||||||
|
|
@ -84,6 +85,7 @@ export class IssueStore implements IIssueStore {
|
||||||
set(this.issuesMap, [issueId, key], issue[key as keyof TIssue]);
|
set(this.issuesMap, [issueId, key], issue[key as keyof TIssue]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
updatePersistentLayer(issueId);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -96,6 +98,7 @@ export class IssueStore implements IIssueStore {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
delete this.issuesMap[issueId];
|
delete this.issuesMap[issueId];
|
||||||
});
|
});
|
||||||
|
deleteIssueFromLocal(issueId);
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper methods
|
// helper methods
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue