diff --git a/reflex/.templates/web/utils/state.js b/reflex/.templates/web/utils/state.js index fa2c87ca4..9b280df9a 100644 --- a/reflex/.templates/web/utils/state.js +++ b/reflex/.templates/web/utils/state.js @@ -3,6 +3,7 @@ import axios from "axios"; import io from "socket.io-client"; import JSON5 from "json5"; import env from "$/env.json"; +import reflexEnvironment from "$/reflex.json"; import Cookies from "universal-cookie"; import { useEffect, useRef, useState } from "react"; import Router, { useRouter } from "next/router"; @@ -407,7 +408,7 @@ export const connect = async ( socket.current = io(endpoint.href, { path: endpoint["pathname"], transports: transports, - protocols: [env.REFLEX_VERSION], + protocols: env.TEST_MODE ? undefined : [reflexEnvironment.version], autoUnref: false, }); // Ensure undefined fields in events are sent as null instead of removed diff --git a/reflex/utils/build.py b/reflex/utils/build.py index 696efad53..9c609cf5e 100644 --- a/reflex/utils/build.py +++ b/reflex/utils/build.py @@ -21,7 +21,7 @@ def set_env_json(): str(prerequisites.get_web_dir() / constants.Dirs.ENV_JSON), { **{endpoint.name: endpoint.get_url() for endpoint in constants.Endpoint}, - "REFLEX_VERSION": constants.Reflex.VERSION, + "TEST_MODE": os.environ.get("PYTEST_CURRENT_TEST", False), }, )