fix(Playlist): Only try extracting the subtitle for the first page#465
fix(Playlist): Only try extracting the subtitle for the first page#465LuanRT merged 1 commit intoLuanRT:mainfrom
Conversation
| ...this.page.metadata?.item().as(PlaylistMetadata), | ||
| ...{ | ||
| subtitle: header.subtitle, | ||
| subtitle: header ? header.subtitle : null, |
There was a problem hiding this comment.
The rest of this file uses header?. instead so i'm not sure if header?.subtitle would be preferred
Ex:
can_share: header?.can_share,
can_delete: header?.can_delete,
There was a problem hiding this comment.
Using header?.subtitle would result in it returning undefined, which would change the type of the subtitle property from Text | null to Text | null | undefined. This could be mitigated by doing header?.subtitle ?? null, but due to YouTube.js targetting ES2016, it gets transpiled to the rather verbose: (_b = header === null || header === void 0 ? void 0 : header.subtitle) !== null && _b !== void 0 ? _b : null,.
I can change the type of subtitle to be Text | undefined, if you would prefer that over null, I definitely don't want both null and undefined being possible?
Playlist continuations don't have the header so we should only try extracting the subtitle for the first playlist page.
closes #464
bug introduced in #458, which added support for the subtitle