[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:
Satish Gandham 2024-09-26 14:04:59 +05:30 committed by GitHub
parent 6e0ece496a
commit f3340749e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 48 additions and 42 deletions

View file

@ -14,7 +14,6 @@ import { persistence } from "@/local-db/storage.sqlite";
// services
import { addIssue, addIssuesBulk, deleteIssueFromLocal } from "@/local-db/utils/load-issues";
import { updatePersistentLayer } from "@/local-db/utils/utils";
import { APIService } from "@/services/api.service";
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> {
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/`, data)
.then((response) => {
updatePersistentLayer(response?.data?.id);
return response?.data;
})
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
@ -147,7 +143,6 @@ export class IssueService extends APIService {
issues: string[];
}
) {
updatePersistentLayer(data.issues);
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/cycle-issues/`, data)
.then((response) => response?.data)
.catch((error) => {
@ -177,7 +172,6 @@ export class IssueService extends APIService {
relation?: "blocking" | null;
}
) {
updatePersistentLayer(issueId);
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-relation/`, data)
.then((response) => response?.data)
.catch((error) => {
@ -218,7 +212,6 @@ export class IssueService extends APIService {
}
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)
.then((response) => response?.data)
.catch((error) => {
@ -249,7 +242,6 @@ export class IssueService extends APIService {
issueId: string,
data: { sub_issue_ids: string[] }
): Promise<TIssueSubIssues> {
updatePersistentLayer([issueId, ...data.sub_issue_ids]);
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/sub-issues/`, data)
.then((response) => response?.data)
.catch((error) => {
@ -271,7 +263,6 @@ export class IssueService extends APIService {
issueId: string,
data: Partial<TIssueLink>
): Promise<TIssueLink> {
updatePersistentLayer(issueId);
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/`, data)
.then((response) => response?.data)
.catch((error) => {
@ -286,7 +277,6 @@ export class IssueService extends APIService {
linkId: string,
data: Partial<TIssueLink>
): Promise<TIssueLink> {
updatePersistentLayer(issueId);
return this.patch(
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`,
data
@ -298,7 +288,6 @@ export class IssueService extends APIService {
}
async deleteIssueLink(workspaceSlug: string, projectId: string, issueId: string, linkId: string): Promise<any> {
updatePersistentLayer(issueId);
return this.delete(
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-links/${linkId}/`
)