Skip to content

Commit

Permalink
chore: debug full cache local store issue
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Dec 5, 2023
1 parent c1d55b1 commit c0dd051
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/home/render-github-issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c0dd051

Please sign in to comment.