mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
chore(lint): add perf category to oxlint and fix resulting warnings
- Enable `perf: warn` in `.oxlintrc.json` and add `builtin` env; disable `no-await-in-loop` and `react/no-array-index-key` globally
- Reorder plugins so `oxc` is first
- Add `.oxfmtrc.json` override to suppress trailing commas in JSON/JSONC files
- Replace spread-into-new-object patterns (`{ ...x, key: val }`) with `Object.assign(x, { key: val })` in discover, explore, integrations, search, credits, and image-cache to satisfy perf rules
- Memoize `ChartContext` and `ToggleGroupContext` provider values to avoid unnecessary re-renders
This commit is contained in:
@@ -361,8 +361,7 @@ export function getCastForTitle(titleId: string): CastMember[] {
|
||||
.orderBy(titleCast.displayOrder)
|
||||
.all();
|
||||
|
||||
return rows.map((r) => ({
|
||||
...r,
|
||||
profilePath: tmdbImageUrl(r.profilePath, "profiles"),
|
||||
}));
|
||||
return rows.map((r) =>
|
||||
Object.assign(r, { profilePath: tmdbImageUrl(r.profilePath, "profiles") }),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -146,10 +146,11 @@ export async function cacheImagesForTitle(titleId: string) {
|
||||
|
||||
// Parallel cache checks instead of sequential awaits
|
||||
const checks = await Promise.all(
|
||||
candidates.map(async (c) => ({
|
||||
...c,
|
||||
cached: await isImageCached(c.category, path.basename(c.imgPath)),
|
||||
})),
|
||||
candidates.map(async (c) =>
|
||||
Object.assign(c, {
|
||||
cached: await isImageCached(c.category, path.basename(c.imgPath)),
|
||||
}),
|
||||
),
|
||||
);
|
||||
const tasks = checks
|
||||
.filter((c) => !c.cached)
|
||||
|
||||
Reference in New Issue
Block a user