Skip to content

Commit f3b2f77

Browse files
authored
fix(alert): remove extra alert div (#1)
1 parent be289e1 commit f3b2f77

1 file changed

Lines changed: 2 additions & 22 deletions

File tree

ui/app.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ function App() {
4343
setAlerts((prev) => [...prev, msg]);
4444
}, []);
4545
const [bellBounce, setBellBounce] = React.useState(false);
46-
const [showAlert, setShowAlert] = React.useState(false);
4746
const [search, setSearch] = React.useState("");
4847
const [expanded, setExpanded] = React.useState({});
4948
const [collapsed, setCollapsed] = React.useState({});
@@ -346,7 +345,6 @@ function App() {
346345
let msg =
347346
e.message || (e.reason && e.reason.message) || String(e.reason || e);
348347
addAlert(msg);
349-
setShowAlert(true);
350348
};
351349
window.addEventListener("error", errHandler);
352350
window.addEventListener("unhandledrejection", errHandler);
@@ -362,7 +360,6 @@ function App() {
362360
origError.apply(console, args);
363361
const msg = args.map((a) => (a && a.message) || a).join(" ");
364362
addAlert(String(msg));
365-
setShowAlert(true);
366363
};
367364
return () => {
368365
console.error = origError;
@@ -401,13 +398,6 @@ function App() {
401398
}
402399
}, [alerts]);
403400

404-
React.useEffect(() => {
405-
if (alerts.length > 0) {
406-
setShowAlert(true);
407-
const t = setTimeout(() => setShowAlert(false), 3000);
408-
return () => clearTimeout(t);
409-
}
410-
}, [alerts]);
411401

412402
React.useEffect(() => {
413403
if (loading && statusMessages.length > 1) {
@@ -688,7 +678,6 @@ function App() {
688678

689679
setCacheStatus("");
690680

691-
setShowAlert(false);
692681

693682
let ver = forcedVer !== null ? forcedVer : version;
694683
if (!ver) {
@@ -703,7 +692,7 @@ function App() {
703692
const controller = new AbortController();
704693
const timer = setTimeout(() => {
705694
addAlert("Request timed out. Some dependencies may be missing.");
706-
setShowAlert(true);
695+
707696
controller.abort();
708697
}, 60000);
709698
abortRef.current = { controller, timer };
@@ -1462,12 +1451,6 @@ function App() {
14621451
return e(
14631452
"div",
14641453
null,
1465-
showAlert &&
1466-
e(
1467-
"div",
1468-
{ className: "alert-toast" },
1469-
alerts.map((msg, i) => e("div", { key: i }, msg))
1470-
),
14711454
loading &&
14721455
e(
14731456
"div",
@@ -1546,11 +1529,9 @@ function App() {
15461529
"span",
15471530
{
15481531
className: "alert-icon-container",
1549-
onMouseEnter: () => alerts.length && setShowAlert(true),
1550-
onMouseLeave: () => alerts.length && setShowAlert(false),
1532+
15511533
onClick: () => {
15521534
if (alerts.length) setAlerts([]);
1553-
setShowAlert(false);
15541535
},
15551536
},
15561537
e("img", {
@@ -1560,7 +1541,6 @@ function App() {
15601541
alerts.length > 0 &&
15611542
e("span", { className: "notification-badge" }),
15621543
alerts.length > 0 &&
1563-
showAlert &&
15641544
e(
15651545
"div",
15661546
{ className: "alert-box" },

0 commit comments

Comments
 (0)