Skip to content

Commit

Permalink
Use an equality check instead of startswith
Browse files Browse the repository at this point in the history
Avoid sweeping up all libraries that start with `"react"`, because there's a
lot of them.
  • Loading branch information
masenf committed Sep 28, 2024
1 parent eea5dc1 commit 4f862fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion reflex/components/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
):
Expand Down

0 comments on commit 4f862fa

Please sign in to comment.