solid icon indicating copy to clipboard operation
solid copied to clipboard

Possible to tell if a tag doesn't get a value?

Open sb8244 opened this issue 2 years ago • 1 comments

Apologies for using the issue tracker for help.

I am wondering if you see any way to detect whether a tag results in no value? I have a use case where I want to display an error (or even the {{ name }} text) if a value isn't available.

I attempted to look down the path of providing my own Solid.Context struct, but I don't think there is a place that I could hook in (even hacky) to detect an empty value.

sb8244 avatar Jun 28 '22 21:06 sb8244

I think that this is called "strict variables" and "strict filters" mode in Liquid: https://www.rubydoc.info/gems/liquid/4.0.1#undefined-variables-and-filters

The stateless nature of Elixir can make the error accumulator difficult. I'd personally be okay with a Process based error collector, although I know that's pretty hacky 😆

sb8244 avatar Jun 28 '22 21:06 sb8244

Strict variables has been implemented #105 . I've created an issue for strict filters: https://github.com/edgurgel/solid/issues/107

edgurgel avatar Sep 16 '22 09:09 edgurgel