aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-05-11 01:01:46 +0100
committerHayleigh Thompson <me@hayleigh.dev>2024-05-11 01:01:46 +0100
commitba58db799bae62c765302b335b45ac14cf1a4fdb (patch)
tree9737a859f3360bfa61036692f523f9e663df69e0 /src
parent80e2bd66f54bca88a749d40784828d29bae8995f (diff)
downloadlustre-ba58db799bae62c765302b335b45ac14cf1a4fdb.tar.gz
lustre-ba58db799bae62c765302b335b45ac14cf1a4fdb.zip
:bug: Fixed a bug where dynamic.classify has inconsistent behaviour between 0.36.0 and 0.37.0
Diffstat (limited to 'src')
-rw-r--r--src/lustre/internals/vdom.gleam11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lustre/internals/vdom.gleam b/src/lustre/internals/vdom.gleam
index ff60c5f..6363c9b 100644
--- a/src/lustre/internals/vdom.gleam
+++ b/src/lustre/internals/vdom.gleam
@@ -372,10 +372,13 @@ fn attribute_to_string_parts(
// want to render `disabled="false"` if the value is `false` we simply
// want to omit the attribute altogether.
//
- // On the Erlang target, booleans are actually just the atoms `true` and
- // `false`!
- "Atom" | "Boolean" if value == true_atom -> Ok(#(name, ""))
- "Atom" | "Boolean" -> Error(Nil)
+ // The behaviour of `dynamic.classify` on booleans on the Erlang target
+ // depends on what version of the standard library you have. <= 0.36.0
+ // will classify `true` and `false` as `"Atom"` but >= 0.37.0 will be
+ // smarter and classify them as `"Bool"`.
+ //
+ "Atom" | "Bool" | "Boolean" if value == true_atom -> Ok(#(name, ""))
+ "Atom" | "Bool" | "Boolean" -> Error(Nil)
// For everything else, we care whether or not the attribute is actually
// a property. Properties are *Javascript* values that aren't necessarily