-
Notifications
You must be signed in to change notification settings - Fork 336
[render preview] web: reintroduce server aggregator for agents + fix store empty-state #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…\n\n- Add web/src/server/agents-data.ts with cached DB aggregation\n- Refactor API route to use shared aggregator\n- Add client fallback hydration in store-client when SSR agents is empty\n- Tweak Jest config to avoid Bun-runner suites; add skipped test placeholders\n- Keep ISR/cache headers on API route
…gregator\n\n- Add web/src/server/agents-transform.ts (pure merge/sort logic)\n- Use it in web/src/server/agents-data.ts\n- Add unit test: web/src/server/__tests__/agents-transform.test.ts
…ame/id mapping, sorting)
…ache script; add SSR e2e test + LHCI + docs
…dd note on enabling in non-latency-sensitive workflows
…dd comment on how to re-enable later
…ht. Local e2e remain runnable and can be re-enabled in separate workflow.
…ck approach for cache warm-up
…file changes; docs updated
Implement multi-layered agents cache warming to ensure data is available immediately on Render deployment for SEO crawlers: - Add prebuild-agents-cache.ts script that runs after next build - Update build command to automatically warm cache during build process - Enhance /api/healthz endpoint to actively fetch and cache agents data - Update documentation with new cache warming strategy This solves the issue where Render deployments had empty cache on startup, causing slow/failed responses for SEO bots hitting /store page metadata.
…ild script Fix two deployment issues: 1. Handle last_used as string or Date in agents-transform.ts - Database returns dates as strings, not Date objects - Add type guards before calling toISOString() - Update type annotations to allow Date | string | null 2. Remove unstable_cache usage from prebuild script - unstable_cache requires Next.js runtime context - Change to call fetchAgentsWithMetrics() directly - Export fetchAgentsWithMetrics for use in build scripts - Update script to validate data pipeline instead of cache warming 3. Update documentation to reflect actual behavior - Build-time: validates data pipeline - Runtime health check: actual cache warming This fixes the "toISOString is not a function" and "incrementalCache missing" errors.
Remove test-specific code from production page.tsx by using Playwright's route mocking for both SSR and hydration tests: - Remove E2E_ENABLE_QUERY_FIXTURE env var checks from page.tsx - Remove e2eFixture query param handling from page.tsx - Delete web/src/app/store/e2e-fixture.ts (no longer needed) - Update store-ssr.spec.ts to use page.route() for API mocking - Update documentation to reflect Playwright-based mocking approach This keeps production code clean and uses proper e2e testing patterns where test infrastructure handles mocking instead of production code having test-specific branches.
Replace awkward 'await (await import(...))' pattern with clean static imports. Server Components can use regular imports without code-splitting concerns.
Remove manual cache warming script since health check endpoint now handles cache warming automatically on Render deployments. - Delete web/scripts/warm-store-cache.ts - Remove "warm:store" script from package.json - Update README to remove manual warming references The prebuild validation script remains for build-time data pipeline checks, and /api/healthz handles runtime cache warming automatically.
Add error logging to all getCachedAgents() calls for better observability: - Store page: Log errors in both generateMetadata and StorePage - Sitemap: Log errors when fetching agents for sitemap generation - All errors use consistent [Context] prefix format Replace useEffect + fetch with useQuery in store-client.tsx: - More declarative data fetching with React Query - Better error handling and caching - Proper stale time configuration (10 minutes) - Cleaner code without manual state management
Use NEXT_PUBLIC_WEB_PORT env var in Playwright config instead of hardcoding port 3001. This allows Playwright to use the same port as the dev server and prevents conflicts when running tests locally. Also removed E2E_ENABLE_QUERY_FIXTURE env var since we removed that logic from production code in favor of Playwright's route mocking.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.