From 767c377d622ef4277531ba7a9c12e48eeb73fc52 Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Fri, 20 Mar 2026 17:51:42 -0700 Subject: [PATCH 1/2] avoid validating app when running in backend only --- reflex/reflex.py | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/reflex/reflex.py b/reflex/reflex.py index cb677c3173e..baaa4a2f084 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -211,29 +211,30 @@ def _run( prerequisites.check_latest_package_version(constants.Reflex.MODULE_NAME) - # Get the app module. - app_task = prerequisites.compile_or_validate_app - args = (frontend,) - kwargs = { - "check_if_schema_up_to_date": True, - "prerender_routes": exec.should_prerender_routes(), - } - - # Granian fails if the app is already imported. - if should_use_granian(): - import concurrent.futures - - compile_future = concurrent.futures.ProcessPoolExecutor(max_workers=1).submit( - app_task, - *args, - **kwargs, - ) - return_result = compile_future.result() - else: - return_result = app_task(*args, **kwargs) + if frontend: + # Get the app module. + app_task = prerequisites.compile_or_validate_app + args = (frontend,) + kwargs = { + "check_if_schema_up_to_date": True, + "prerender_routes": exec.should_prerender_routes(), + } + + # Granian fails if the app is already imported. + if should_use_granian(): + import concurrent.futures + + compile_future = concurrent.futures.ProcessPoolExecutor(max_workers=1).submit( + app_task, + *args, + **kwargs, + ) + return_result = compile_future.result() + else: + return_result = app_task(*args, **kwargs) - if not return_result: - raise SystemExit(1) + if not return_result: + raise SystemExit(1) if env != constants.Env.PROD and env != constants.Env.DEV: msg = f"Invalid env: {env}. Must be DEV or PROD." From 3bf200cb69b61d3a7598de8bd40aba5e0c849c9e Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Mon, 23 Mar 2026 10:28:08 -0700 Subject: [PATCH 2/2] precommit --- reflex/reflex.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reflex/reflex.py b/reflex/reflex.py index baaa4a2f084..7c3f98465b2 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -224,7 +224,9 @@ def _run( if should_use_granian(): import concurrent.futures - compile_future = concurrent.futures.ProcessPoolExecutor(max_workers=1).submit( + compile_future = concurrent.futures.ProcessPoolExecutor( + max_workers=1 + ).submit( app_task, *args, **kwargs,