From a345c6cb622809829c690ccd3b794f92f192ffab Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Thu, 23 Jan 2025 14:23:51 -0800 Subject: [PATCH] Revert "check frontend version on connect (#4611)" This reverts commit 0c70146013fa25f077bd38785c0215cd7b44a53b. --- reflex/.templates/web/utils/state.js | 2 -- reflex/app.py | 6 +----- reflex/constants/__init__.py | 1 - reflex/constants/base.py | 1 - reflex/testing.py | 1 - reflex/utils/build.py | 6 +----- reflex/utils/exec.py | 9 --------- 7 files changed, 2 insertions(+), 24 deletions(-) diff --git a/reflex/.templates/web/utils/state.js b/reflex/.templates/web/utils/state.js index 5b8046347..ec603fd13 100644 --- a/reflex/.templates/web/utils/state.js +++ b/reflex/.templates/web/utils/state.js @@ -3,7 +3,6 @@ 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"; @@ -408,7 +407,6 @@ export const connect = async ( socket.current = io(endpoint.href, { path: endpoint["pathname"], transports: transports, - 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/app.py b/reflex/app.py index 5ee424719..09b86409d 100644 --- a/reflex/app.py +++ b/reflex/app.py @@ -1563,11 +1563,7 @@ class EventNamespace(AsyncNamespace): sid: The Socket.IO session id. environ: The request information, including HTTP headers. """ - subprotocol = environ.get("HTTP_SEC_WEBSOCKET_PROTOCOL", None) - if subprotocol and subprotocol != constants.Reflex.VERSION: - console.warn( - f"Frontend version {subprotocol} for session {sid} does not match the backend version {constants.Reflex.VERSION}." - ) + pass def on_disconnect(self, sid): """Event for when the websocket disconnects. diff --git a/reflex/constants/__init__.py b/reflex/constants/__init__.py index f5946bf5e..e816da0f7 100644 --- a/reflex/constants/__init__.py +++ b/reflex/constants/__init__.py @@ -1,7 +1,6 @@ """The constants package.""" from .base import ( - APP_HARNESS_FLAG, COOKIES, IS_LINUX, IS_MACOS, diff --git a/reflex/constants/base.py b/reflex/constants/base.py index f737858c0..af96583ad 100644 --- a/reflex/constants/base.py +++ b/reflex/constants/base.py @@ -257,7 +257,6 @@ SESSION_STORAGE = "session_storage" # Testing variables. # Testing os env set by pytest when running a test case. PYTEST_CURRENT_TEST = "PYTEST_CURRENT_TEST" -APP_HARNESS_FLAG = "APP_HARNESS_FLAG" REFLEX_VAR_OPENING_TAG = "" REFLEX_VAR_CLOSING_TAG = "" diff --git a/reflex/testing.py b/reflex/testing.py index 7c6aab93b..227f27343 100644 --- a/reflex/testing.py +++ b/reflex/testing.py @@ -282,7 +282,6 @@ class AppHarness: before_decorated_pages = reflex.app.DECORATED_PAGES[self.app_name].copy() # Ensure the AppHarness test does not skip State assignment due to running via pytest os.environ.pop(reflex.constants.PYTEST_CURRENT_TEST, None) - os.environ[reflex.constants.APP_HARNESS_FLAG] = "true" self.app_module = reflex.utils.prerequisites.get_compiled_app( # Do not reload the module for pre-existing apps (only apps generated from source) reload=self.app_source is not None diff --git a/reflex/utils/build.py b/reflex/utils/build.py index 9ea941792..e263374e1 100644 --- a/reflex/utils/build.py +++ b/reflex/utils/build.py @@ -13,17 +13,13 @@ from rich.progress import MofNCompleteColumn, Progress, TimeElapsedColumn from reflex import constants from reflex.config import get_config from reflex.utils import console, path_ops, prerequisites, processes -from reflex.utils.exec import is_in_app_harness def set_env_json(): """Write the upload url to a REFLEX_JSON.""" path_ops.update_json_file( str(prerequisites.get_web_dir() / constants.Dirs.ENV_JSON), - { - **{endpoint.name: endpoint.get_url() for endpoint in constants.Endpoint}, - "TEST_MODE": is_in_app_harness(), - }, + {endpoint.name: endpoint.get_url() for endpoint in constants.Endpoint}, ) diff --git a/reflex/utils/exec.py b/reflex/utils/exec.py index 9a5b70112..1c534e37a 100644 --- a/reflex/utils/exec.py +++ b/reflex/utils/exec.py @@ -512,15 +512,6 @@ def is_testing_env() -> bool: return constants.PYTEST_CURRENT_TEST in os.environ -def is_in_app_harness() -> bool: - """Whether the app is running in the app harness. - - Returns: - True if the app is running in the app harness. - """ - return constants.APP_HARNESS_FLAG in os.environ - - def is_prod_mode() -> bool: """Check if the app is running in production mode.