diff --git a/reflex/.templates/web/utils/state.js b/reflex/.templates/web/utils/state.js index 009910a32..a431ca4f1 100644 --- a/reflex/.templates/web/utils/state.js +++ b/reflex/.templates/web/utils/state.js @@ -112,12 +112,9 @@ export const getBackendURL = (url_str) => { * @returns True if the backend is disabled, false otherwise. */ export const isBackendDisabled = () => { - const cookie = document.cookie - .split("; ") - .find((row) => row.startsWith("backend-enabled=")); - return cookie !== undefined && cookie.split("=")[1] == "false"; + const backendEnabled = cookies.get("backend-enabled"); + return backendEnabled === "false"; }; - /** * Determine if any event in the event queue is stateful. * diff --git a/reflex/components/core/banner.py b/reflex/components/core/banner.py index 92d3a8424..882975f2f 100644 --- a/reflex/components/core/banner.py +++ b/reflex/components/core/banner.py @@ -4,6 +4,7 @@ from __future__ import annotations from typing import Optional +from reflex import constants from reflex.components.component import Component from reflex.components.core.cond import cond from reflex.components.datadisplay.logo import svg_logo @@ -318,7 +319,9 @@ class BackendDisabled(Div): "useEffect(() => { setBackendDisabled(isBackendDisabled()); }, []);": None, }, imports={ - f"$/{constants.Dirs.STATE_PATH}": [ImportVar(tag="isBackendDisabled")], + f"$/{constants.Dirs.STATE_PATH}": [ + ImportVar(tag="isBackendDisabled") + ], }, ), )