Skip to content

fix: drop bloques with invalid timestamps before render#23

Merged
danieldiazde merged 1 commit into
mainfrom
chore/post-hackathon-cleanup
May 11, 2026
Merged

fix: drop bloques with invalid timestamps before render#23
danieldiazde merged 1 commit into
mainfrom
chore/post-hackathon-cleanup

Conversation

@danieldiazde
Copy link
Copy Markdown
Owner

Summary

  • Gemini occasionally returns bloques_sugeridos entries whose inicio_iso / fin_iso are not parseable as ISO 8601. parseISO returned Invalid Date, format() then threw RangeError: Invalid time value, crashing the dashboard the first time the Aplicar Bloques dialog opened.
  • Filter invalid blocks in two places:
    • api/insights/generate — before upserting to the insights cache, so future loads stay clean.
    • app/(app)/dashboard/page.tsx — at load time, as defense-in-depth for insights already cached with bad data.
  • No new dependencies; parseISO / isValid come from the date-fns import that was already in both files.

Test plan

  • npm run typecheck passes
  • Local smoke: login → onboarding → dashboard renders without crash even when Gemini returned malformed timestamps
  • After merge, dashboard on the new Vercel deploy renders cleanly for a freshly-onboarded user

🤖 Generated with Claude Code

Gemini occasionally returns bloques_sugeridos entries with
unparseable inicio_iso/fin_iso strings. parseISO yielded Invalid
Date, format() then threw RangeError and crashed the dashboard
the first time the user opened the Aplicar Bloques dialog.

Filter invalid blocks in two places:
- api/insights/generate before upserting to cache
- dashboard page on load as defense-in-depth for insights that
  may already be cached with bad blocks

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gemini-hackdays-frontend-w3rx Ready Ready Preview, Comment May 11, 2026 4:20pm

@supabase
Copy link
Copy Markdown

supabase Bot commented May 11, 2026

This pull request has been ignored for the connected project jwqffychkaczvknfgzbd because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@danieldiazde danieldiazde merged commit d353583 into main May 11, 2026
4 checks passed
@danieldiazde danieldiazde deleted the chore/post-hackathon-cleanup branch May 12, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant