🧹 [code health improvement] Implement data fetching for cryptogram#30
🧹 [code health improvement] Implement data fetching for cryptogram#30lemononmars wants to merge 1 commit into
Conversation
…gram
Replaced the static data lookup placeholder in `src/routes/puzzles/cryptogram/[id].ts` with a proper Supabase query. Preserved the array-based logic as a robust fallback.
- Added `import { from }` and executed an asynchronous Supabase `from('cryptogram').select('*')` query to retrieve data.
- Handled errors and formatting mappings so it adheres to the expected `content` structure (`type` and `date`).
- Maintained backward compatibility via static data fallback if the DB fetch fails or returns no matches.
- Extracted and safely retained the previous modulo `id` bounds-wrapping logic required by existing components.
Co-authored-by: lemononmars <26631189+lemononmars@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🎯 What: The code health issue addressed
Implemented true asynchronous data fetching logic for the Cryptogram puzzle route
src/routes/puzzles/cryptogram/[id].tsto resolve an existingTODO: make it fetch, await, etc?placeholder.💡 Why: How this improves maintainability
The prior code solely relied on hardcoded local arrays, preventing the puzzle content from scaling or updating dynamically via the CMS database (Supabase). By correctly fetching from Supabase with a fallback to the static data array, the component is robust, ready for dynamically published content, yet safe from regressions.
✅ Verification: How you confirmed the change is safe
Ran Svelte checks, rebuilt the server output using
npm run build, and ran unit tests vianpm run test, ensuring existing utility tests and code structures remain unimpacted. Pre-existing static fallback behavior was thoroughly preserved.✨ Result: The improvement achieved
A cleaner, more scalable routing endpoint capable of seamlessly querying live puzzle database records without breaking backward compatibility for older, statically defined puzzles.
PR created automatically by Jules for task 4104112311433260691 started by @lemononmars