Harden multi-node dropdown initialization

This commit is contained in:
Cosimo Ricciardi 2026-05-14 18:44:32 +02:00
parent cbad48bd32
commit 977a7b382e
2 changed files with 3 additions and 3 deletions

View file

@ -152,8 +152,8 @@ describe('RTL Root Effects', () => {
actions.next({ type: RTLActions.FETCH_APPLICATION_SETTINGS });
const sub = effects.appConfigFetch.subscribe((appConfigResponse) => {
expect(appConfigResponse).toEqual({ type: RTLActions.SET_APPLICATION_SETTINGS, payload: appConfig });
const setSelectedNodeAction = storeDispatchSpy.calls.all()[4].args[0] as any;
expect(setSelectedNodeAction.type).toEqual(RTLActions.SET_SELECTED_NODE);
const setSelectedNodeAction = storeDispatchSpy.calls.all().find((call) => (call.args[0] as any).type === RTLActions.SET_SELECTED_NODE)?.args[0] as any;
expect(setSelectedNodeAction).toBeTruthy();
expect(setSelectedNodeAction.payload.currentLnNode.index).toEqual(appConfig.nodes[0].index);
done();
setTimeout(() => sub.unsubscribe());

View file

@ -221,7 +221,7 @@ export class RTLEffects implements OnDestroy {
let searchNode: Node | null = null;
rtlConfig.nodes.forEach((node) => {
node.settings.currencyUnits = [...CURRENCY_UNITS, (node.settings?.currencyUnit ? node.settings?.currencyUnit : '')];
if (+(node.index || -1) === +rtlConfig.selectedNodeIndex) {
if (+(node.index ?? -1) === +rtlConfig.selectedNodeIndex) {
searchNode = node;
}
});