Skip to content

Commit 67149f5

Browse files
committed
Add HTMX error handler, Mermaid try-catch, remove unused CSS
- Global htmx:responseError handler shows error message on failed requests - Wrap Mermaid re-render in try-catch to prevent silent failures - Remove unused .facts CSS class (30 lines of dead code)
1 parent 17ba129 commit 67149f5

3 files changed

Lines changed: 10 additions & 34 deletions

File tree

app/web/static/styles.css

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -885,37 +885,6 @@ h3 {
885885
color: var(--text);
886886
}
887887

888-
.facts {
889-
display: grid;
890-
grid-template-columns: repeat(3, 1fr);
891-
gap: 0;
892-
margin: 4px 0;
893-
border: 1px solid rgb(255 255 255 / 5%);
894-
border-radius: 8px;
895-
overflow: hidden;
896-
}
897-
898-
.facts div {
899-
padding: 10px 14px;
900-
}
901-
902-
.facts div + div {
903-
border-left: 1px solid rgb(255 255 255 / 5%);
904-
}
905-
906-
.facts dt {
907-
color: rgb(154 165 177 / 60%);
908-
font-size: 11px;
909-
margin-bottom: 2px;
910-
}
911-
912-
.facts dd {
913-
margin: 0;
914-
font-size: 13px;
915-
font-weight: 500;
916-
color: var(--text);
917-
}
918-
919888
/* Split pane (sidebar + detail) */
920889
.settings-split {
921890
display: grid;
@@ -1030,7 +999,6 @@ h3 {
1030999
}
10311000

10321001
.inline-grid,
1033-
.facts,
10341002
.fetch-row {
10351003
grid-template-columns: 1fr;
10361004
}

app/web/templates/base.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
88
<link rel="stylesheet" href="/static/styles.css" />
99
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
10+
<script>
11+
document.addEventListener('htmx:responseError', function(e) {
12+
var target = e.detail.target;
13+
if (target) {
14+
target.innerHTML = '<div class="error">Request failed (' + e.detail.xhr.status + '). Please try again.</div>';
15+
}
16+
});
17+
</script>
1018
</head>
1119
<body>
1220
<div class="bg-grid"></div>

app/web/templates/chat.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ <h2>No session selected</h2>
180180

181181
// Re-render Mermaid diagrams after HTMX swap (for /schema command)
182182
document.body.addEventListener('htmx:afterSwap', function() {
183-
if (typeof mermaid !== 'undefined') {
184-
mermaid.run();
183+
if (typeof mermaid !== 'undefined' && mermaid.run) {
184+
try { mermaid.run(); } catch (e) { console.error('Mermaid render:', e); }
185185
}
186186
});
187187
</script>

0 commit comments

Comments
 (0)