Update Deprecations (#1927)

This commit is contained in:
Elijah Ahianyo 2023-10-05 19:12:42 +00:00 committed by GitHub
parent a72a6b7d2f
commit 513835cf74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 17 deletions

View File

@ -407,8 +407,8 @@ class App(Base):
console.deprecate(
feature_name="Passing script tags to add_page",
reason="Add script components as children to the page component instead",
deprecation_version="v0.2.9",
removal_version="v0.2.11",
deprecation_version="0.3.0",
removal_version="0.3.2",
)
component.children.extend(script_tags)

View File

@ -91,7 +91,7 @@ def client_side(javascript_code) -> Var[EventChain]:
console.deprecate(
feature_name="rx.client_side",
reason="and has been replaced by rx.call_script, which can be used from backend EventHandler too",
deprecation_version="0.2.9",
removal_version="0.2.10",
deprecation_version="0.3.0",
removal_version="0.3.1",
)
return BaseVar(name=f"...args => {{{javascript_code}}}", type_=EventChain)

View File

@ -241,7 +241,7 @@ class Component(Base, ABC):
feature_name="EventChain",
reason="to avoid confusion, only use yield API",
deprecation_version="0.2.8",
removal_version="0.2.9",
removal_version="0.3.1",
)
events = []
for v in value:
@ -296,7 +296,7 @@ class Component(Base, ABC):
feature_name=f"get_triggers ({self.__class__.__name__})",
reason="replaced by get_event_triggers",
deprecation_version="0.2.8",
removal_version="0.2.9",
removal_version="0.3.1",
)
deprecated_triggers = {
trigger: lambda: [] for trigger in deprecated_triggers
@ -310,7 +310,7 @@ class Component(Base, ABC):
feature_name=f"get_controlled_triggers ({self.__class__.__name__})",
reason="replaced by get_event_triggers",
deprecation_version="0.2.8",
removal_version="0.2.9",
removal_version="0.3.1",
)
return {

View File

@ -105,8 +105,8 @@ class Markdown(Component):
console.deprecate(
"rx.markdown custom_styles",
"Use the component_map prop instead.",
"0.2.9",
"0.2.11",
"0.3.0",
"0.3.2",
)
# Update the base component map with the custom component map.

View File

@ -333,8 +333,8 @@ def set_cookie(key: str, value: str) -> EventSpec:
console.deprecate(
feature_name=f"rx.set_cookie",
reason="and has been replaced by rx.Cookie, which can be used as a state var",
deprecation_version="0.2.9",
removal_version="0.2.10",
deprecation_version="0.3.0",
removal_version="0.3.1",
)
return server_side(
"_set_cookie",
@ -375,8 +375,8 @@ def set_local_storage(key: str, value: str) -> EventSpec:
console.deprecate(
feature_name=f"rx.set_local_storage",
reason="and has been replaced by rx.LocalStorage, which can be used as a state var",
deprecation_version="0.2.9",
removal_version="0.2.10",
deprecation_version="0.3.0",
removal_version="0.3.1",
)
return server_side(
"_set_local_storage",
@ -537,7 +537,7 @@ def call_event_handler(
feature_name="EVENT_ARG API for triggers",
reason="Replaced by new API using lambda allow arbitrary number of args",
deprecation_version="0.2.8",
removal_version="0.2.9",
removal_version="0.3.1",
)
if len(args) == 1:
return event_handler()

View File

@ -102,7 +102,6 @@ def warn(msg: str, **kwargs):
print(f"[orange1]Warning: {msg}[/orange1]", **kwargs)
# def deprecate(msg: str, **kwargs):
def deprecate(
feature_name: str,
reason: str,

View File

@ -1464,8 +1464,8 @@ def get_local_storage(key: Var | str | None = None) -> BaseVar:
console.deprecate(
feature_name=f"rx.get_local_storage",
reason="and has been replaced by rx.LocalStorage, which can be used as a state var",
deprecation_version="0.2.9",
removal_version="0.2.10",
deprecation_version="0.3.0",
removal_version="0.3.1",
)
if key is not None:
if not (isinstance(key, Var) and key.type_ == str) and not isinstance(key, str):