Await recommendations fetch during title import

Recommendations were fetched fire-and-forget, causing a race condition
where the title detail page would load before recommendations were
populated in the database, making the section appear intermittently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 13:55:57 -05:00
co-authored by Claude Opus 4.6
parent 8c31784094
commit 5a2d3fa473
+3 -3
View File
@@ -56,7 +56,7 @@ export async function importTitle(tmdbId: number, type: "movie" | "tv") {
}
await refreshTvChildren(existing.id, tmdbId, show.number_of_seasons);
refreshAvailability(existing.id).catch(() => {});
refreshRecommendations(existing.id).catch(() => {});
await refreshRecommendations(existing.id).catch(() => {});
if (imageCacheEnabled()) {
cacheImagesForTitle(existing.id).catch(() => {});
cacheEpisodeStills(existing.id).catch(() => {});
@@ -92,7 +92,7 @@ export async function importTitle(tmdbId: number, type: "movie" | "tv") {
.get();
// Fire-and-forget: fetch availability, recommendations, colors & image cache
refreshAvailability(row.id).catch(() => {});
refreshRecommendations(row.id).catch(() => {});
await refreshRecommendations(row.id).catch(() => {});
extractAndStoreColors(row.id, movie.poster_path).catch(() => {});
if (imageCacheEnabled()) cacheImagesForTitle(row.id).catch(() => {});
return row;
@@ -122,7 +122,7 @@ export async function importTitle(tmdbId: number, type: "movie" | "tv") {
await refreshTvChildren(row.id, tmdbId, show.number_of_seasons);
// Fire-and-forget: fetch availability, recommendations, colors & image cache
refreshAvailability(row.id).catch(() => {});
refreshRecommendations(row.id).catch(() => {});
await refreshRecommendations(row.id).catch(() => {});
extractAndStoreColors(row.id, show.poster_path).catch(() => {});
if (imageCacheEnabled()) {
cacheImagesForTitle(row.id).catch(() => {});