Custom Components in Brookyn not rendering with conditional rendering

  • 2
  • Problem
  • Updated 2 years ago
  • Not a Problem
We have a Custom Component that is not being rendered in Brooklyn, we have conditional rendering to show it based on some model data.
We narrowed it down to this: When we remove the conditional rendering, the component is rendered, when we add conditional rendering that evaluates to true on page load, the component is, rendered, hidden and subsequently re-rendered based on the model data it depends on, but when the conditional rendering evaluates to false on page load, even if it subsequently evaluates to true, it never renders.
Photo of Velvel Marasow

Velvel Marasow

  • 452 Points 250 badge 2x thumb

Posted 2 years ago

  • 2
Photo of Keith Heard

Keith Heard

  • 122 Points 100 badge 2x thumb
I'm having the same issue. It was fine before Brooklyn.
Photo of Mordechai


  • 988 Points 500 badge 2x thumb
So here's the hack that worked for us:
  1. Add a new "Template" component, set to "Allow HTML", add this as the contents:
    <style type="text/css">#<id-of-problematic-component> {display:none;}</style>
  2. Add a custom Rendering condition to this new template that sets it to render when the first option is selected.
  3. Update the Rendering condition on your existing "problematic" component to also render on first load.

In effect what you're doing is rendering the component in two cases just that in the default case it's hidden.