From c0dd051e749cde955deabf58c9d8cc7bda9e79eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A2=E3=83=AC=E3=82=AF=E3=82=B5=E3=83=B3=E3=83=80?= =?UTF-8?q?=E3=83=BC=2Eeth?= Date: Tue, 5 Dec 2023 20:24:03 +0900 Subject: [PATCH] chore: debug full cache local store issue --- src/home/render-github-issues.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/home/render-github-issues.ts b/src/home/render-github-issues.ts index 71cae9c3..12540c2b 100644 --- a/src/home/render-github-issues.ts +++ b/src/home/render-github-issues.ts @@ -172,13 +172,18 @@ export async function renderGitHubIssues(container: HTMLDivElement, issues: GitH // Function to update and show the preview function previewIssue(issuePreview: GitHubIssueWithNewFlag) { - const issuesFull = JSON.parse(localStorage.getItem("gitHubIssuesFull") || "[]"); + const issuesFull = JSON.parse(localStorage.getItem("gitHubIssuesFull") || "{}"); const issuePreviewUrl = issuePreview.body.match(/https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+/)?.[0]; - if (!issuePreviewUrl) throw new Error("Issue preview URL not found"); + if (!issuePreviewUrl) { + throw new Error("Issue preview URL not found"); + } const issueFull = findIssueByUrl(issuesFull, issuePreviewUrl); - if (!issueFull) throw new Error("Issue not found"); + if (!issueFull) { + console.trace({ issuePreviewUrl, issuesFull }); + throw new Error("Issue not found"); + } // Update the title and body for the new issue titleHeader.textContent = issuePreview.title;