From 4f862fa00913242c4e73e4154aa6f0ef256c5332 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Sat, 28 Sep 2024 09:41:30 -0700 Subject: [PATCH] Use an equality check instead of startswith Avoid sweeping up all libraries that start with `"react"`, because there's a lot of them. --- reflex/components/dynamic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reflex/components/dynamic.py b/reflex/components/dynamic.py index ad044d54f1..390b6e6882 100644 --- a/reflex/components/dynamic.py +++ b/reflex/components/dynamic.py @@ -2,6 +2,7 @@ from reflex import constants from reflex.utils import imports +from reflex.utils.format import format_library_name from reflex.utils.serializers import serializer from reflex.vars import Var, get_unique_variable_name from reflex.vars.base import VarData, transform @@ -64,11 +65,12 @@ def make_component(component: Component) -> str: imports = {} for lib, names in component._get_all_imports().items(): + formatted_lib_name = format_library_name(lib) if ( not lib.startswith((".", "/")) and not lib.startswith("http") and all( - not lib.startswith(lib_in_window) + formatted_lib_name != lib_in_window for lib_in_window in libs_in_window ) ):