Skip to content

Commit ddb286c

Browse files
committed
fixed the popup window disappear issue described in #596
1 parent 0796426 commit ddb286c

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/popup/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import React from "react";
77
import ReactDOM from "react-dom";
88
import "bootstrap/dist/css/bootstrap.min.css";
99
import "bootstrap/dist/js/bootstrap.bundle.min";
10-
import { HashRouter as Router } from "react-router-dom";
10+
import { MemoryRouter as Router } from "react-router-dom";
1111
import AppView from "./views/app-view";
1212

1313
/**

src/popup/views/label-view/index.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,19 @@ const LabelView = () => {
5555
const website = params.website; // Get website passed from route
5656
const label = params.label; // Get label passed from route
5757

58-
useEffect(
59-
() =>
60-
// @ts-ignore
61-
getWebsiteLastVisitedEvidence(website).then((result) => {
58+
useEffect(() => {
59+
// Define an async function inside the effect
60+
async function fetchData() {
61+
try {
62+
const result = await getWebsiteLastVisitedEvidence(website);
6263
const a = result?.[label] ?? {};
6364
setRequests(a);
64-
}),
65-
[]
66-
);
65+
} catch (err) {
66+
console.error("Failed to load website evidence:", err);
67+
}
68+
}
69+
fetchData();
70+
}, []);
6771

6872
return (
6973
<Scaffold
@@ -72,6 +76,7 @@ const LabelView = () => {
7276
leading={
7377
<SLeading
7478
onClick={() => {
79+
console.log("clicked");
7580
navigate("/", { replace: true });
7681
const getAnalysis = async () => {
7782
const status = await getAnalyticsStatus();
@@ -85,7 +90,9 @@ const LabelView = () => {
8590
);
8691
}
8792
};
93+
console.log("clicked3");
8894
getAnalysis();
95+
console.log("clicked4");
8996
}}
9097
>
9198
<Icons.Back size="24px" />

0 commit comments

Comments
 (0)