Skip to content

Commit 84da42f

Browse files
committed
fix: Phase 3 findings — feed limit bypass, summary ThemeToggle
- Fix feed GET limit=-1 bypass (clamp to 1-100 with NaN fallback) - Replace emoji theme toggle with ThemeToggle in summary page (missed in Phase 1)
1 parent 77ac762 commit 84da42f

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

app/api/feed/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export async function GET(request: NextRequest) {
7878
}
7979

8080
const { searchParams } = new URL(request.url);
81-
const limit = Math.min(parseInt(searchParams.get("limit") || "50", 10), 100);
81+
const limit = Math.max(1, Math.min(parseInt(searchParams.get("limit") || "50", 10) || 50, 100));
8282
const category = searchParams.get("category") || undefined;
8383

8484
if (shouldUseDynamo()) {

app/intake/summary/page.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { BiomarkerAggregate } from "../../types/biomarker";
1111
import type { Session } from "../../types/session";
1212
import { useTheme } from "../../hooks/useTheme";
1313
import { INTAKE_STEPS, STEP_INDEX } from "../../lib/constants/intake";
14+
import ThemeToggle from "../../components/ThemeToggle";
1415

1516
const STEPS = INTAKE_STEPS;
1617
const STEP_IDX = STEP_INDEX.summary;
@@ -154,13 +155,7 @@ function SummaryPage() {
154155
<img src="/logo.jpeg" alt="" className="logo-icon" /><span>Auti<em>Sense</em></span>
155156
</Link>
156157
<div style={{ display: "flex", alignItems: "center", gap: 10 }}>
157-
<button
158-
onClick={toggleTheme}
159-
className="btn btn-outline"
160-
style={{ minHeight: 40, padding: "8px 14px", fontSize: "0.88rem" }}
161-
>
162-
{theme === "light" ? "🌙" : "☀️"}
163-
</button>
158+
<ThemeToggle theme={theme} onToggle={toggleTheme} />
164159
<span
165160
style={{
166161
fontSize: "0.88rem",

0 commit comments

Comments
 (0)