From ba58db799bae62c765302b335b45ac14cf1a4fdb Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Sat, 11 May 2024 01:01:46 +0100 Subject: :bug: Fixed a bug where dynamic.classify has inconsistent behaviour between 0.36.0 and 0.37.0 --- src/lustre/internals/vdom.gleam | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.3