From 698121ab8f62fbed6e78892277caf93a9890b930 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sun, 8 Jun 2025 12:12:26 +0200 Subject: [PATCH] fix: Handle CommandExecutorCommand in NavigationEndpoint.call (#968) Co-authored-by: Luan --- src/parser/classes/NavigationEndpoint.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parser/classes/NavigationEndpoint.ts b/src/parser/classes/NavigationEndpoint.ts index 65a1e1f5..6f22ecf4 100644 --- a/src/parser/classes/NavigationEndpoint.ts +++ b/src/parser/classes/NavigationEndpoint.ts @@ -2,6 +2,7 @@ import { YTNode } from '../helpers.js'; import { Parser, type IEndpoint, type RawNode } from '../index.js'; import OpenPopupAction from './actions/OpenPopupAction.js'; import CreatePlaylistDialog from './CreatePlaylistDialog.js'; +import CommandExecutorCommand from './commands/CommandExecutorCommand.js'; import type Actions from '../../core/Actions.js'; import type ModalWithTitleAndButton from './ModalWithTitleAndButton.js'; @@ -124,7 +125,12 @@ export default class NavigationEndpoint extends YTNode { throw new Error('An API caller must be provided'); if (this.command) { - const command = this.command as (YTNode & IEndpoint); + let command = this.command as (YTNode & IEndpoint); + + if (command.is(CommandExecutorCommand)) { + command = command.commands.at(-1) as (YTNode & IEndpoint); + } + return actions.execute(command.getApiPath(), { ...command.buildRequest(), ...args }); }