default back to title and desc, and replace brs with new lines

This commit is contained in:
Khaleel Al-Adhami 2025-02-20 13:07:54 -08:00
parent 3226556cd9
commit 307adcb81d

View File

@ -278,7 +278,15 @@ class Toaster(Component):
toast = ternary_operation(
toast_ref.bool(),
toast,
FunctionVar("window.alert").call(message),
FunctionVar("window.alert").call(
Var.create(
message
if isinstance(message, str) and message
else props.get("title", props.get("description", ""))
)
.to(str)
.replace("<br/>", "\n")
),
)
return run_script(toast)