mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 21:16:09 +00:00
fix: actually fix default props in components
This commit is contained in:
parent
9a942e8674
commit
eef42a9a9f
@ -19,7 +19,7 @@ export abstract class ComponentCommand {
|
|||||||
|
|
||||||
middlewares: (keyof RegisteredMiddlewares)[] = [];
|
middlewares: (keyof RegisteredMiddlewares)[] = [];
|
||||||
|
|
||||||
props: ExtraProps = {};
|
props!: ExtraProps;
|
||||||
|
|
||||||
get cType(): number {
|
get cType(): number {
|
||||||
return ComponentType[this.componentType];
|
return ComponentType[this.componentType];
|
||||||
|
@ -174,17 +174,11 @@ export class ComponentHandler extends BaseHandler {
|
|||||||
}
|
}
|
||||||
if (!(component instanceof ModalCommand || component instanceof ComponentCommand)) continue;
|
if (!(component instanceof ModalCommand || component instanceof ComponentCommand)) continue;
|
||||||
component.props ??= this.client.options.commands?.defaults?.props ?? {};
|
component.props ??= this.client.options.commands?.defaults?.props ?? {};
|
||||||
if (component instanceof ModalCommand) {
|
const is = component instanceof ModalCommand ? 'modals' : 'components';
|
||||||
component.onInternalError ??= this.client.options?.modals?.defaults?.onInternalError;
|
component.onInternalError ??= this.client.options?.[is]?.defaults?.onInternalError;
|
||||||
component.onMiddlewaresError ??= this.client.options?.modals?.defaults?.onMiddlewaresError;
|
component.onMiddlewaresError ??= this.client.options?.[is]?.defaults?.onMiddlewaresError;
|
||||||
component.onRunError ??= this.client.options?.modals?.defaults?.onRunError;
|
component.onRunError ??= this.client.options?.[is]?.defaults?.onRunError;
|
||||||
component.onAfterRun ??= this.client.options?.modals?.defaults?.onAfterRun;
|
component.onAfterRun ??= this.client.options?.[is]?.defaults?.onAfterRun;
|
||||||
} else {
|
|
||||||
component.onInternalError ??= this.client.options?.components?.defaults?.onInternalError;
|
|
||||||
component.onMiddlewaresError ??= this.client.options?.components?.defaults?.onMiddlewaresError;
|
|
||||||
component.onRunError ??= this.client.options?.components?.defaults?.onRunError;
|
|
||||||
component.onAfterRun ??= this.client.options?.components?.defaults?.onAfterRun;
|
|
||||||
}
|
|
||||||
component.__filePath = value.path;
|
component.__filePath = value.path;
|
||||||
this.commands.push(component);
|
this.commands.push(component);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ export abstract class ModalCommand {
|
|||||||
|
|
||||||
middlewares: (keyof RegisteredMiddlewares)[] = [];
|
middlewares: (keyof RegisteredMiddlewares)[] = [];
|
||||||
|
|
||||||
props: ExtraProps = {};
|
props!: ExtraProps;
|
||||||
|
|
||||||
onAfterRun?(context: ModalContext, error: unknown | undefined): any;
|
onAfterRun?(context: ModalContext, error: unknown | undefined): any;
|
||||||
onRunError?(context: ModalContext, error: unknown): any;
|
onRunError?(context: ModalContext, error: unknown): any;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user