fix(templates): fix ErrorToast rendering literal { message } instead of error text

ErrorToast used Go string literal '{ message }' instead of templ
interpolation, so the actual error message was never shown — just the
literal text "{ message }" appeared in the toast.
This commit is contained in:
2026-05-10 16:13:21 -04:00
parent be1c373b19
commit 5bdddc6538
2 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -2,6 +2,6 @@ package templates
templ ErrorToast(message string) {
if message != "" {
<div x-data="toastError" x-init="showErrorToast('{ message }')"></div>
<div x-data="toastError" x-init={ "showErrorToast('" + message + "')" }></div>
}
}
+15 -2
View File
@@ -1,6 +1,6 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.1001
// templ: version: v0.3.1020
package templates
//lint:file-ignore SA4006 This context is only used if a nested component is present.
@@ -30,7 +30,20 @@ func ErrorToast(message string) templ.Component {
}
ctx = templ.ClearChildren(ctx)
if message != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div x-data=\"toastError\" x-init=\"showErrorToast('{ message }')\"></div>")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div x-data=\"toastError\" x-init=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.ResolveAttributeValue("showErrorToast('" + message + "')")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `toast.templ`, Line: 5, Col: 71}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\"></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}