Skip to content

Commit 184246d

Browse files
committed
Heatmap refreshes on data updates via SSE
1 parent 51778a9 commit 184246d

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Position reaction picker at top right of message bubble
1717
* Improve reaction badge styling and hover states
1818
* Add Slack-style tooltip showing who reacted with each emoji
19+
* Heatmap updates in real time when expenses are added or synced
1920

2021
### 1.9.4: 2026-03-25
2122

src/components/dashboard/spending-heatmap.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { Card } from "@/components/ui/card";
44
import { useLocale } from "@/lib/locale-context";
5+
import { useEvent } from "@/lib/use-events";
56
import { useState, useEffect, useRef, useCallback } from "react";
67
import { isTransfer } from "@/lib/transaction-utils";
78

@@ -28,7 +29,7 @@ export function SpendingHeatmap() {
2829
const cardRef = useRef<HTMLDivElement>(null);
2930
const [tooltip, setTooltip] = useState<TooltipData | null>(null);
3031

31-
useEffect(() => {
32+
const loadHeatmap = useCallback(() => {
3233
fetch("/api/heatmap")
3334
.then((r) => r.json())
3435
.then((data) => {
@@ -39,6 +40,9 @@ export function SpendingHeatmap() {
3940
.catch(() => {});
4041
}, []);
4142

43+
useEffect(() => { loadHeatmap(); }, [loadHeatmap]);
44+
useEvent("data:updated", loadHeatmap);
45+
4246
useEffect(() => {
4347
requestAnimationFrame(() => {
4448
if (scrollRef.current) {

0 commit comments

Comments
 (0)