Skip to content

⚡ Bolt: Add module-level caching for BlogApp#99

Closed
schmug wants to merge 1 commit into
mainfrom
bolt-optimization-blogapp-cache-11360143037787946840
Closed

⚡ Bolt: Add module-level caching for BlogApp#99
schmug wants to merge 1 commit into
mainfrom
bolt-optimization-blogapp-cache-11360143037787946840

Conversation

@schmug
Copy link
Copy Markdown
Owner

@schmug schmug commented May 7, 2026

💡 What:

  • Implements a module-level cache for /api/blog.json in BlogApp.tsx.
  • Adds AbortSignal.timeout(10000) to fetch requests across BlogApp.tsx, useProjects.ts, and github.ts.

🎯 Why:
When the user opens multiple instances of BlogApp (or remounts it quickly via window manager), React triggers duplicate network requests for the same semi-static data payload. Caching the Promise globally deduplicates these requests. Additionally, unbound fetch calls leave the React application vulnerable to indefinite hangs if the network is flaky.

📊 Impact:

  • Reduces duplicate /api/blog.json payload network requests by 100% on subsequent remounts or simultaneous renders.
  • Prevents indefinite Promise hangs, releasing React suspense/loading states within 10 seconds max.

🔬 Measurement:
Open the application in dev mode, open the network tab, and rapidly open 5 instances of the Blog app via the taskbar. Previously, this would trigger 5 identical fetch requests. Now, it will only trigger 1 request. Additionally, artificially delaying the API response beyond 10s will now reliably trigger the fallback error UI rather than hanging indefinitely.


PR created automatically by Jules for task 11360143037787946840 started by @schmug

- Adds `fetchPromise` cache to `BlogApp.tsx` to deduplicate multiple requests on multiple mount instances (e.g. multi-windows in OS shell)
- Adds `signal: AbortSignal.timeout(10000)` to `fetch` calls in `BlogApp.tsx`, `useProjects.ts`, and `github.ts` to prevent UI hangs or DoS
- Ensures caching properly resets on error so retries can occur

Co-authored-by: schmug <38227427+schmug@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@schmug
Copy link
Copy Markdown
Owner Author

schmug commented May 16, 2026

Superseded by #127 (merged to main), which consolidated the best of the duplicate Bolt/Sentinel/Palette scheduled-agent PRs into one reviewed change. Closing as duplicate.

@schmug schmug closed this May 16, 2026
@google-labs-jules
Copy link
Copy Markdown
Contributor

Superseded by #127 (merged to main), which consolidated the best of the duplicate Bolt/Sentinel/Palette scheduled-agent PRs into one reviewed change. Closing as duplicate.

Understood. Acknowledging that this work is now obsolete and stopping work on this task.

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