Skip to content

Commit a1313ba

Browse files
committed
perf(calendar): serve hot releases from a single endpoint
Replaces the client-side hot releases assembly (a releases-calendar fetch plus separate trending and anticipated fetches per media type, then an in-browser intersect) with one request to the new `/calendars/releases/hot` endpoint, which does the gating and merge server-side and returns the feed already ordered by availability date. The mapper now just discriminates the union response, coalesces episodes and sorts. Drops the now-dead `sourceLimit` param from both callers and the `HideRecommended` invalidations. Bumps @trakt/api to 0.4.22 for the new contract.
1 parent 6c5d2af commit a1313ba

7 files changed

Lines changed: 69 additions & 297 deletions

File tree

deno.lock

Lines changed: 23 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"@tanstack/query-core": "5.101.2",
8282
"@tanstack/query-devtools": "5.101.2",
8383
"@tanstack/query-persist-client-core": "5.101.2",
84-
"@trakt/api": "npm:@jsr/trakt__api@0.4.21",
84+
"@trakt/api": "npm:@jsr/trakt__api@0.4.22",
8585
"@ts-rest/core": "3.52.1",
8686
"@use-gesture/vanilla": "10.3.1",
8787
"bits-ui": "2.18.1",

projects/client/src/lib/features/calendar/_internal/useReleasesCalendar.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import type { FilterParams } from '../../../requests/models/FilterParams.ts';
1414
import type { DiscoverMode } from '../../filters/models/DiscoverMode.ts';
1515
import type { Calendar } from '../models/Calendar.ts';
1616

17-
const releasesCalendarSourceLimit = 50;
18-
1917
type UseReleasesCalendarParams = {
2018
start: Date;
2119
days: number;
@@ -43,7 +41,6 @@ export function useReleasesCalendar(
4341
type: props.type,
4442
filter: props.filter,
4543
filterOverride: props.filterOverride,
46-
sourceLimit: releasesCalendarSourceLimit,
4744
}),
4845
);
4946

projects/client/src/lib/requests/queries/calendars/releasesCalendarQuery.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ import { describe, expect, it } from 'vitest';
77
import { releasesCalendarQuery } from './releasesCalendarQuery.ts';
88

99
describe('releasesCalendarQuery', () => {
10-
it('should query all calendar entries that are in releases source lists', async () => {
10+
it('should merge the hot releases feed into mapped calendar entries', async () => {
1111
const result = await runQuery({
1212
factory: () =>
1313
createTestBedQuery(
1414
releasesCalendarQuery({
1515
startDate: new Date(Date.now() - time.days(1)).toISOString(),
1616
days: 30,
1717
type: 'media',
18-
sourceLimit: 10,
1918
}),
2019
),
2120
mapper: (response) => response?.data,

0 commit comments

Comments
 (0)