keep-chakra: whitelist is always whitelist (#2585)

Regardless of whether the same name exists in the top level rx.<x> namespace,
always convert whitelisted names to rx.chakra.<x>
This commit is contained in:
Masen Furer 2024-02-12 14:55:39 -08:00 committed by GitHub
parent fc6eff7104
commit eafe53369e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1003,18 +1003,17 @@ def _get_rx_chakra_component_to_migrate() -> set[str]:
rx_chakra_names = set(dir(reflex.chakra))
names_to_migrate = set()
# whitelist names will always be rewritten as rx.chakra.<x>
whitelist = {
"CodeBlock",
"ColorModeIcon",
"MultiSelect",
"MultiSelectOption",
"base",
"code_block",
"color_mode_cond",
"color_mode_icon",
"multi_select",
"multi_select_option",
}
for rx_chakra_name in sorted(rx_chakra_names):
if rx_chakra_name.startswith("_"):
continue
@ -1032,12 +1031,8 @@ def _get_rx_chakra_component_to_migrate() -> set[str]:
rx_chakra_object, ChakraComponent
):
names_to_migrate.add(rx_chakra_name)
pass
else:
# For the given rx.chakra.<x>, does rx.<x> exist?
# And of these, should we include in migration?
if hasattr(reflex, rx_chakra_name) and rx_chakra_name in whitelist:
names_to_migrate.add(rx_chakra_name)
elif rx_chakra_name in whitelist:
names_to_migrate.add(rx_chakra_name)
except Exception:
raise