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-2001] feat: Fix local cache issues r3 #5714

Merged
merged 9 commits into from
Sep 27, 2024
Merged

Conversation

SatishGandham
Copy link
Contributor

@SatishGandham SatishGandham commented Sep 27, 2024

Summary by CodeRabbit

  • New Features

    • Users can now toggle local database caching directly from the sidebar, with controls reflecting the current workspace and project context.
    • Enhanced indexing capabilities with the addition of a new field, sequence_id, improving data retrieval efficiency.
    • Introduced handling for issue_type in query parameters, allowing for more refined data queries.
  • Bug Fixes

    • Improved SQL robustness by ensuring single quotes in data are properly escaped to prevent syntax issues.
  • Chores

    • Updated asynchronous processing in data updates to ensure accurate retrieval and merging of issue properties.

Copy link
Contributor

coderabbitai bot commented Sep 27, 2024

Walkthrough

The pull request introduces multiple modifications across several files, primarily focusing on enhancing SQL query handling, indexing capabilities, and local database caching management. Key changes include the addition of a new index field, "sequence_id", improvements in escaping single quotes in SQL queries, and updates to various functions to incorporate the new field in query parameters and SQL generation. The ProfileSettingsPage component has been simplified by removing local cache handling logic, while asynchronous handling has been introduced in the updatePersistentLayer function to improve data retrieval processes.

Changes

File Path Change Summary
web/app/profile/page.tsx Removed local cache handling logic from ProfileSettingsPage, simplifying the component.
web/core/components/workspace/sidebar/help-section.tsx Added useParams to extract workspaceSlug and projectId, integrated local DB caching toggle.
web/core/local-db/utils/indexes.ts Added "sequence_id" to the array of index fields in createIssueIndexes function.
web/core/local-db/utils/load-workspace.ts Enhanced stageInserts function to escape single quotes in strings and JSON stringified objects.
web/core/local-db/utils/query.utils.ts Modified multiple functions to include issue_type, replace created_at with sequence_id, and update SQL logic.
web/core/local-db/utils/utils.ts Updated updatePersistentLayer to handle asynchronous issue retrieval and expanded issuePartial properties.
web/core/store/user/settings.store.ts Updated toggleLocalDB method to accept workspaceSlug and projectId for context-aware operations.
web/core/local-db/storage.sqlite.ts Added this.reset() call in the error handling block of the Storage class after attempting to remove the file system directory.

Possibly related PRs

  • [WEB-2001]feat: Cache issues on the client #5327: This PR introduces a toggle feature for local database caching in the ProfileSettingsPage, which directly connects to the main PR's removal of the local cache handling logic.
  • [WEB-2001] fix: Issue local cache fixes #5703: This PR addresses issues with local cache functionality, including escaping single quotes in dynamic queries, which aligns with the main PR's focus on simplifying the ProfileSettingsPage component by removing local cache features.
  • [WEB-2001] feat: Fix local cache issues v2 #5712: This PR also focuses on fixing local cache issues, including handling single quotes in queries and ensuring that issue descriptions are retained, which relates to the main PR's changes in the ProfileSettingsPage regarding local cache management.

Suggested labels

🐛bug, ⚙️backend, 🌐frontend, 🧹chore

Suggested reviewers

  • rahulramesha
  • sriramveeraghanta

Poem

In the garden where data hops,
New fields bloom, and old ones swap.
With quotes escaped, our SQL sings,
As rabbits dance on joyful springs.
Sequence IDs now take the lead,
Enhancements sprout from every seed! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
web/core/local-db/utils/load-workspace.ts (1)

30-33: Approve changes with a minor suggestion for improvement

The modifications to escape single quotes in both JSON stringified objects and regular strings are excellent. They effectively prevent SQL injection and syntax errors when inserting data into the local database, which aligns with the PR objective of fixing local cache issues.

Consider extracting the quote escaping logic into a separate function for better maintainability and reusability. For example:

const escapeSingleQuotes = (value: string) => value.replace(/'/g, "''");

// Then use it like this:
if (typeof value === "object") {
  return `'${escapeSingleQuotes(JSON.stringify(value))}'`;
}
if (typeof value === "string") {
  return `'${escapeSingleQuotes(value)}'`;
}

This refactoring would make the code more DRY and easier to maintain if you need to modify the escaping logic in the future.

🛑 Comments failed to post (2)
web/core/local-db/utils/utils.ts (2)

19-21: ⚠️ Potential issue

Potential issue with using async functions inside forEach loop

Using async functions within a forEach loop can lead to unexpected behavior because forEach does not await asynchronous operations. This means that the await calls inside the loop may not complete before the function exits, leading to potential issues with data consistency.

Consider replacing the forEach loop with a for...of loop to correctly handle asynchronous operations:

-  issueIds.forEach(async (issueId) => {
+  for (const issueId of issueIds) {
     const dbIssue = await persistence.getIssue(issueId);
     const issue = rootStore.issue.issues.getIssueById(issueId);

     if (issue) {
       // JSON.parse(JSON.stringify(issue)) is used to remove the mobx observables
       const issuePartial = pick({ ...dbIssue, ...JSON.parse(JSON.stringify(issue)) }, [
         // ...properties
         "description_html",
       ]);
       updateIssue({ ...issuePartial, is_local_update: 1 });
     }
-  });
+  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  for (const issueId of issueIds) {
    const dbIssue = await persistence.getIssue(issueId);
    const issue = rootStore.issue.issues.getIssueById(issueId);
    if (issue) {
      // JSON.parse(JSON.stringify(issue)) is used to remove the mobx observables
      const issuePartial = pick({ ...dbIssue, ...JSON.parse(JSON.stringify(issue)) }, [
        // ...properties
        "description_html",
      ]);
      updateIssue({ ...issuePartial, is_local_update: 1 });
    }
  }

24-25: 🛠️ Refactor suggestion

Improve performance by avoiding unnecessary serialization

Using JSON.parse(JSON.stringify(issue)) to remove MobX observables can be inefficient and may impact performance, especially with large objects.

Consider using MobX's toJS utility to create a plain JavaScript object more efficiently:

-      // JSON.parse(JSON.stringify(issue)) is used to remove the mobx observables
-      const issuePartial = pick({ ...dbIssue, ...JSON.parse(JSON.stringify(issue)) }, [
+      import { toJS } from "mobx";
+      const issuePartial = pick({ ...dbIssue, ...toJS(issue) }, [
         // ...properties
         "description_html",
       ]);

Committable suggestion was skipped due to low confidence.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Outside diff range and nitpick comments (5)
web/app/profile/page.tsx (1)

Line range hint 1-458: Suggestions for code quality improvements

While the overall code structure is good, here are a few suggestions to further improve code quality and maintainability:

  1. Consider extracting the handleDelete function into a separate utility function or custom hook. This would improve readability of the main component.

  2. For consistency, consider moving all inline styles to className-based styling. This would make the styling more maintainable and easier to update.

  3. The form submission logic in onSubmit function could potentially be moved to a custom hook to separate concerns and make the component more focused on rendering.

  4. Consider adding more descriptive comments for complex logic sections, especially around form validation rules.

These are minor suggestions and the current implementation is already of good quality. Implementing these could further enhance the maintainability and readability of the code.

web/core/store/user/settings.store.ts (4)

Line range hint 83-86: Provide detailed error information in catch block

In the catch block, the error is being caught but only a generic warning is logged. Including the error details can help with debugging.

Update the console.warn to include the error details:

     } catch (e) {
-      console.warn("error while toggling local DB");
+      console.warn("Error while toggling local DB:", e);
       runInAction(() => {
         this.canUseLocalDB = currentLocalDBValue;
       });
     }

Line range hint 66-70: Update 'canUseLocalDB' after successful localStorage update

It might be better to update this.canUseLocalDB only after confirming that setValueIntoLocalStorage was successful. This ensures the observable state remains consistent with the actual local storage value.

Apply this diff to update this.canUseLocalDB after successfully updating localStorage:

       try {
-        runInAction(() => {
-          this.canUseLocalDB = !currentLocalDBValue;
-        });

         const transactionResult = setValueIntoLocalStorage(LOCAL_DB_ENABLED, !currentLocalDBValue);

         if (!transactionResult) {
           throw new Error("error while toggling local DB");
         }

+        runInAction(() => {
+          this.canUseLocalDB = !currentLocalDBValue;
+        });

Line range hint 62-87: Add JSDoc comments to 'toggleLocalDB' method for better documentation

Adding JSDoc comments to the toggleLocalDB method will improve code readability and maintainability by providing context and usage information.

Consider adding a JSDoc comment like:

/**
 * Toggles the local database usage.
 * @param workspaceSlug - The slug of the workspace.
 * @param projectId - The ID of the project.
 */

Line range hint 62-87: Add unit tests for 'toggleLocalDB' method

Consider adding unit tests for the toggleLocalDB method to ensure its correctness, especially given its asynchronous operations and multiple conditional branches.

Do you want me to help in drafting unit tests for this method or open a GitHub issue to track this task?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 44a2244 and aaa59c1.

📒 Files selected for processing (3)
  • web/app/profile/page.tsx (1 hunks)
  • web/core/components/workspace/sidebar/help-section.tsx (2 hunks)
  • web/core/store/user/settings.store.ts (3 hunks)
🔇 Additional comments (3)
web/app/profile/page.tsx (3)

9-10: LGTM: Import statements have been optimized.

The consolidation of import statements and removal of unused imports (such as useUserSettings) improves code readability and maintains consistency with the removal of local cache functionality.

Also applies to: 19-19, 21-21


Line range hint 1-458: Clarification needed: Removal of local cache functionality

The local cache functionality, including the useUserSettings hook and the associated UI elements, has been completely removed from the component. While this aligns with the PR objective of fixing local cache issues, it's a significant change that might impact users who relied on this feature.

Could you please provide more context on:

  1. The specific issues that led to the decision to remove the local cache feature entirely?
  2. How this change affects the overall user experience and application performance?
  3. Are there any plans to reintroduce a modified version of this feature in the future?

This information will help in understanding the full impact of these changes and ensure that we're not inadvertently removing a valuable feature without proper consideration.


Line range hint 1-458: LGTM: Core functionality of ProfileSettingsPage remains intact

The main functionality of the profile settings page, including handling user profile data updates, form validation, and submission logic, has been preserved. The removal of the local cache feature doesn't appear to have negatively impacted these core features.

The component still effectively manages:

  • User avatar and cover image updates
  • Personal information (name, email, role, etc.)
  • User preferences (timezone)
  • Account deactivation option

The code structure and logic for these features remain well-organized and functional.

@@ -59,7 +59,7 @@ export class UserSettingsStore implements IUserSettingsStore {
this.userService = new UserService();
}

toggleLocalDB = async () => {
toggleLocalDB = async (workspaceSlug: string | undefined, projectId: string | undefined) => {
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

Update method signature to use optional parameters

Ensure that the implementation matches the interface update by using the optional parameter syntax in the method definition as well.

Apply this diff to update the method signature:

-toggleLocalDB = async (workspaceSlug: string | undefined, projectId: string | undefined) => {
+toggleLocalDB = async (workspaceSlug?: string, projectId?: string) => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
toggleLocalDB = async (workspaceSlug: string | undefined, projectId: string | undefined) => {
toggleLocalDB = async (workspaceSlug?: string, projectId?: string) => {

Comment on lines +75 to +80
if (currentLocalDBValue) {
await persistence.clearStorage();
} else if (workspaceSlug) {
await persistence.initialize(workspaceSlug);
persistence.syncWorkspace();
projectId && persistence.syncIssues(projectId);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Await asynchronous operations to ensure proper execution

If persistence.syncWorkspace() and persistence.syncIssues(projectId) are asynchronous functions, you should await them to ensure they complete before proceeding.

Apply this diff to await the asynchronous calls:

-        persistence.syncWorkspace();
-        projectId && persistence.syncIssues(projectId);
+        await persistence.syncWorkspace();
+        if (projectId) {
+          await persistence.syncIssues(projectId);
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (currentLocalDBValue) {
await persistence.clearStorage();
} else if (workspaceSlug) {
await persistence.initialize(workspaceSlug);
persistence.syncWorkspace();
projectId && persistence.syncIssues(projectId);
if (currentLocalDBValue) {
await persistence.clearStorage();
} else if (workspaceSlug) {
await persistence.initialize(workspaceSlug);
await persistence.syncWorkspace();
if (projectId) {
await persistence.syncIssues(projectId);
}

⚠️ Potential issue

Handle cases when 'workspaceSlug' is undefined during initialization

When enabling the local database (currentLocalDBValue is false), if workspaceSlug is not provided, the initialization process is skipped without any notification or error. This might lead to unexpected behavior.

Consider adding validation to ensure that workspaceSlug is provided when enabling the local database, or handle the case appropriately.

Apply this diff to add a warning when workspaceSlug is undefined:

       } else if (workspaceSlug) {
         await persistence.initialize(workspaceSlug);
-        persistence.syncWorkspace();
-        projectId && persistence.syncIssues(projectId);
+        await persistence.syncWorkspace();
+        if (projectId) {
+          await persistence.syncIssues(projectId);
+        }
+      } else {
+        console.warn("Workspace slug is required to initialize local database");
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (currentLocalDBValue) {
await persistence.clearStorage();
} else if (workspaceSlug) {
await persistence.initialize(workspaceSlug);
persistence.syncWorkspace();
projectId && persistence.syncIssues(projectId);
if (currentLocalDBValue) {
await persistence.clearStorage();
} else if (workspaceSlug) {
await persistence.initialize(workspaceSlug);
await persistence.syncWorkspace();
if (projectId) {
await persistence.syncIssues(projectId);
}
} else {
console.warn("Workspace slug is required to initialize local database");
}

@@ -22,7 +22,7 @@
canUseLocalDB: boolean;
// actions
fetchCurrentUserSettings: () => Promise<IUserSettings | undefined>;
toggleLocalDB: () => Promise<void>;
toggleLocalDB: (workspaceSlug: string | undefined, projectId: string | undefined) => Promise<void>;
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

Use optional parameter syntax for cleaner code

In TypeScript, it's more idiomatic to use the optional parameter syntax ? for parameters that may be undefined. This enhances readability and conciseness.

Apply this diff to update the method signature:

-toggleLocalDB: (workspaceSlug: string | undefined, projectId: string | undefined) => Promise<void>;
+toggleLocalDB: (workspaceSlug?: string, projectId?: string) => Promise<void>;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
toggleLocalDB: (workspaceSlug: string | undefined, projectId: string | undefined) => Promise<void>;
toggleLocalDB: (workspaceSlug?: string, projectId?: string) => Promise<void>;

}}
className="flex w-full items-center justify-between text-xs hover:bg-custom-background-80"
>
<span className="racking-tight">Local Cache</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Typo in className 'racking-tight'

The className racking-tight appears to be a typo. It should likely be tracking-tight, which adjusts letter spacing.

Apply this diff to fix the typo:

-<span className="racking-tight">Local Cache</span>
+<span className="tracking-tight">Local Cache</span>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<span className="racking-tight">Local Cache</span>
<span className="tracking-tight">Local Cache</span>

<span className="racking-tight">Local Cache</span>
<ToggleSwitch
value={canUseLocalDB}
onChange={() => toggleLocalDB(workspaceSlug?.toString(), projectId?.toString())}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Handle potential 'undefined' values when calling .toString()

When using optional chaining with .toString(), as in workspaceSlug?.toString(), if workspaceSlug is undefined, calling .toString() on it will result in a TypeError because undefined does not have a toString() method. Consider providing default values or handling undefined cases to prevent potential runtime errors.

Apply this diff to safely handle undefined values:

-onChange={() => toggleLocalDB(workspaceSlug?.toString(), projectId?.toString())}
+onChange={() => toggleLocalDB(workspaceSlug ? workspaceSlug.toString() : '', projectId ? projectId.toString() : '')}

Alternatively, ensure that workspaceSlug and projectId are defined before calling .toString().

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onChange={() => toggleLocalDB(workspaceSlug?.toString(), projectId?.toString())}
onChange={() => toggleLocalDB(workspaceSlug ? workspaceSlug.toString() : '', projectId ? projectId.toString() : '')}

@pushya22 pushya22 merged commit ec08fb0 into preview Sep 27, 2024
13 of 15 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between aaa59c1 and 594ea31.

📒 Files selected for processing (1)
  • web/core/local-db/storage.sqlite.ts (1 hunks)
🔇 Additional comments (2)
web/core/local-db/storage.sqlite.ts (2)

57-57: LGTM: Resetting storage state after clearing.

The addition of this.reset() after attempting to clear the storage is a good practice. It ensures that the Storage instance is reset to its initial state, maintaining consistency between the actual storage state and the instance's internal state.


57-57: Verify the implementation of the reset() method.

The reset() method is called here, but its implementation is not visible in the provided code. Please ensure that the reset() method properly reinitializes all necessary properties of the Storage class.

Comment on lines 54 to 60
const fileSystemDirectoryHandle = await storageManager.getDirectory();
//@ts-expect-error , clear local issue cache
await fileSystemDirectoryHandle.remove({ recursive: true });
this.reset();
} catch (e) {
console.error("Error clearing sqlite sync storage", e);
}
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 improving error handling in clearStorage.

The current implementation logs the error but doesn't propagate it. Consider either:

  1. Throwing the error after logging it to allow proper error handling by the caller.
  2. Returning a boolean indicating success or failure.

This would provide better visibility into storage clearing failures.

Here's a suggested implementation:

 clearStorage = async () => {
   try {
     const storageManager = window.navigator.storage;
     const fileSystemDirectoryHandle = await storageManager.getDirectory();
     //@ts-expect-error , clear local issue cache
     await fileSystemDirectoryHandle.remove({ recursive: true });
     this.reset();
+    return true;
   } catch (e) {
     console.error("Error clearing sqlite sync storage", e);
+    return false;
   }
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const fileSystemDirectoryHandle = await storageManager.getDirectory();
//@ts-expect-error , clear local issue cache
await fileSystemDirectoryHandle.remove({ recursive: true });
this.reset();
} catch (e) {
console.error("Error clearing sqlite sync storage", e);
}
const fileSystemDirectoryHandle = await storageManager.getDirectory();
//@ts-expect-error , clear local issue cache
await fileSystemDirectoryHandle.remove({ recursive: true });
this.reset();
return true;
} catch (e) {
console.error("Error clearing sqlite sync storage", e);
return false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants