diff --git a/public/assets/pages/adminpage/ctrl_backend_component_authentication.js b/public/assets/pages/adminpage/ctrl_backend_component_authentication.js index 5026840ae..75752bf50 100644 --- a/public/assets/pages/adminpage/ctrl_backend_component_authentication.js +++ b/public/assets/pages/adminpage/ctrl_backend_component_authentication.js @@ -61,7 +61,7 @@ export default async function(render) { effect(init$.pipe( rxjs.mergeMap(($nodes) => $nodes), rxjs.mergeMap(($node) => onClick($node)), - rxjs.map(($node) => toggleMiddleware($node.getAttribute("data-label"))), + rxjs.mergeMap(($node) => toggleMiddleware($node.getAttribute("data-label"))), saveMiddleware(), )); diff --git a/public/assets/pages/adminpage/ctrl_backend_state.js b/public/assets/pages/adminpage/ctrl_backend_state.js index 515a332e1..6c118e5f9 100644 --- a/public/assets/pages/adminpage/ctrl_backend_state.js +++ b/public/assets/pages/adminpage/ctrl_backend_state.js @@ -75,9 +75,14 @@ export function getMiddlewareEnabled() { } export function toggleMiddleware(type) { - const newValue = middlewareEnabled$.value === type ? null : type; - middlewareEnabled$.next(newValue); - return newValue; + return middlewareEnabled$.pipe( + rxjs.first(), + rxjs.map((oldValue) => { + const newValue = oldValue === type ? null : type; + middlewareEnabled$.next(newValue); + return newValue; + }), + ); } export function getState() {