taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 2a283209602f1f4acaba942b9910041c35a1906d
parent 0371648c9aaec59004d5f808987ded8c4a53d7a5
Author: Sebastian <sebasjm@taler-systems.com>
Date:   Thu, 27 Nov 2025 09:06:10 -0300

fix edge case of safehandler.lambda

Diffstat:
Mpackages/merchant-backoffice-ui/src/Routing.tsx | 41++++++++++++++++++++++++++++-------------
Mpackages/merchant-backoffice-ui/src/paths/instance/webhooks/list/Table.tsx | 2+-
Mpackages/web-util/src/hooks/useNotifications.ts | 3++-
3 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/packages/merchant-backoffice-ui/src/Routing.tsx b/packages/merchant-backoffice-ui/src/Routing.tsx @@ -223,7 +223,12 @@ export function Routing(_p: Props): VNode { onCancel={() => route(InstancePaths.order_list)} onReseted={() => route(InstancePaths.order_list)} /> - <Route default component={() => <LoginPage showCreateAccount={config.have_self_provisioning} />} /> + <Route + default + component={() => ( + <LoginPage showCreateAccount={config.have_self_provisioning} /> + )} + /> </Router> </Fragment> ); @@ -264,17 +269,30 @@ export function Routing(_p: Props): VNode { <Fragment> <NotificationCard notification={{ - message: "Internal error, please report", + message: "Internal error.", type: "ERROR", description: ( - <pre> - { - (error instanceof Error - ? error.stack - : String(error)) as TranslatedString - } - </pre> + <Fragment> + <i18n.Translate> + The application is in a unexpected state and can't recover + from here. You can report the problem to the developers at{" "} + <a + href="https://bugs.gnunet.org/" + target="_blank" + referrerpolicy="no-referrer" + > + https://bugs.gnunet.org/ + </a> + </i18n.Translate> + <pre> + { + (error instanceof Error + ? error.stack + : String(error)) as TranslatedString + } + </pre> + </Fragment> ), }} /> @@ -689,10 +707,7 @@ export function Routing(_p: Props): VNode { {/** * Statistics pages */} - <Route - path={InstancePaths.statistics} - component={Statistics} - /> + <Route path={InstancePaths.statistics} component={Statistics} /> {/** * Example pages */} diff --git a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/Table.tsx b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/Table.tsx @@ -75,7 +75,7 @@ export function CardTable({ } }; const deleteById = deleteWebhook.lambda((id: string) => - !deleteWebhook.args ? undefined! : [deleteWebhook.args[0], id], + !state.token ? undefined : [state.token, id], ); return ( <Fragment> diff --git a/packages/web-util/src/hooks/useNotifications.ts b/packages/web-util/src/hooks/useNotifications.ts @@ -254,6 +254,7 @@ export function useLocalNotificationBetter(): [ // @ts-expect-error r.withArgs = (...args: D) => { const d = converter(...args); + if (!d) return thiz const e = thiz.withArgs(...d); return e; }; @@ -380,7 +381,7 @@ export interface SafeHandlerTemplate<Args extends any[], Errors> { * @param e */ lambda<OtherArgs extends any[]>( - e: (...d: OtherArgs) => Args, + e: (...d: OtherArgs) => Args | undefined, init?: OtherArgs, ): SafeHandlerTemplate<OtherArgs, Errors>; /**