CartoDB / airship

A design library for building Location Intelligence applications.
https://carto.com/developers/airship/
BSD 3-Clause "New" or "Revised" License
75 stars 14 forks source link

Fix as-responsive-content not loading widgets on panels #603

Closed rjimenezda closed 5 years ago

rjimenezda commented 5 years ago

Ever since Airship v1 this has happened and we only recently noticed.

What's going on?

In order to re-render some widgets that need a parent with actual size, like the histogram or the stacked bar widget, the as-responsive-content widget looks for as-* elements each time you switch tabs and calls forceUpdate, a stencil method to force a full redraw of the element.

If this method is called too early, the stencil lazy loader has not downloaded the actual element script yet, causing it to fail.

We noticed that widgets on the panels, and only on the panels were sometimes not rendering. This happens because we set the first element (in tab order) to active, which is where we're doing the force update. Panels are inside of the map element, despite ending on a different tab, so the query locates them too. If you reorder the tabs so that the sidebar is the first one, the sidebar widgets will fail but not the rest.

Since: A) Most cases put the map on the first tab (default value, too) B) We didn't have legends up until a few weeks ago

We never really had widgets on panels combined with the as-responsive-content widget.

The fix is trivial, I'm blocking the first forceUpdate, which is done when querying the child elements of the component.

rjimenezda commented 5 years ago

It might be worth cherry picking this into a 1.0.x branch and releasing a patch for v1 if someone complains. The bug is definitely there.