mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 03:55:38 -04:00
Optimize performance: batch DB ops, N+1 fixes, Suspense streaming, and Jotai best practices
- Add composite indexes on userEpisodeWatches and userMovieWatches for hot queries - Batch episode tracking: wrap season/batch watches in single transaction (~8 queries vs 8*N) - Fix N+1 patterns in credits, recommendations, and filmography with batch prefetch+insert - Stream TV season hydration via Suspense instead of blocking page render - Optimize webhook logs (per-connection LIMIT 10) and system health queries - Merge genre filter waterfalls into single Promise.all fetch - Migrate deprecated Jotai loadable() to unwrap() - Replace isolated createStore()+Provider with useHydrateAtoms on root store - Remove unnecessary atomWithStorage SSR guards (handled by Jotai internally) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -45,7 +45,11 @@ function getClient() {
|
||||
|
||||
function getDb() {
|
||||
if (!globalForDb._db) {
|
||||
globalForDb._db = drizzle({ client: getClient(), schema, logger: drizzleLogger });
|
||||
globalForDb._db = drizzle({
|
||||
client: getClient(),
|
||||
schema,
|
||||
logger: drizzleLogger,
|
||||
});
|
||||
}
|
||||
return globalForDb._db;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user