← Writing

Shipping recursive hierarchy in 8 weeks with a 25-row budget

Technical brief · Andreas Heim

As Board View approached General Availability, Hierarchy became a late-stage must-have: without it, the product would not ship. The deadline was fixed to the end of the quarter, so slipping was not an option. I led the technical strategy for a recursive feature that had to land in 8 weeks, in a production frontend that had never been designed to support it.

The constraint

The frontend used a normalized flat store: very efficient for single-level operations, with no native way to represent recursive data. Sheets could hold up to 100k rows, so one top-level parent could have thousands of descendants. Rendering that tree naively risked DOM trees large enough to crash the tab, not just slow it down.

The global node budget

I capped the total rendered rows at 25, globally. That turned a variable performance problem into a fixed-cost operation I could reason about, and it made recursive rendering safe without building a custom virtualizer.

The trade-off was deliberate: a small group of users with very dense hierarchies would not see all their data at a glance. I accepted that given the timeline, and designed a “Show more” escape hatch to measure how often the ceiling was actually hit.

Depth-first traversal

A transformation utility bridges the flat store and the nested UI. I mandated a depth-first pattern so a parent and its descendants render together as one unit of work. I set the architectural contract and partnered with another engineer on the implementation, including the global counter, and reviewed the code to make sure memoization was applied correctly.

Filtering without losing context

Filtering raised the hardest question. A top-level card might not match while its children do. I gave Product three options:

Product chose ghosting. To implement it, both API calls are dispatched in parallel when a filter is active. The unfiltered call returns the full ancestor chain and the filtered call returns only matching rows. Ghost ancestors are reconstructed exclusively from the unfiltered response, since they are absent from the filtered one and cannot be inferred from it. A depth limit of 4 on both calls is the first bound on rendering complexity; the 25-row budget applies afterwards, during traversal.

Diagram: a filter triggers an unfiltered and a filtered call in parallel, merged by a DFS pass that tags properties
Two calls in parallel, merged in a single DFS pass.

During one dual-pass traversal, each node is tagged with four properties: matchesFilter (render active), childMatchesFilter (render as a ghost to preserve the path), childIndex (a global counter that halts rendering at the budget), and childRowIds (pre-resolved child IDs, so traversal never rescans the flat store). Together they let the UI make every rendering decision in one pass.

Diagram: a transformed node with its four tagged properties and the resulting render decision
Every node carries what the UI needs to render it, hide it, or ghost it.

Collaborative edge cases

In a collaborative board the 25-row limit is a moving boundary. What happens when a user adds a card at the limit, or someone else adds items at the same time? I chose permissive overflow: a 26th card renders immediately, and the limit only re-applies on a full refresh. Overflow is bounded by what one session adds and never persists across reloads, so the guardrail holds. The alternative, a card the user just created silently vanishing, would have been a serious UX failure.

Negotiating the limit as a hypothesis

The hardest conversation was with Product about the cap. I framed it as a hypothesis: fewer than 5% of users would need to see more than 25 nested items at a glance, and “Show more” would be the instrument that proved or disproved it. After launch, fewer than 2% of users engaged it. That let us defend the limit as a permanent architectural decision backed by data rather than instinct.

Chart: under 2% of hierarchy users engaged Show more, against a 5% hypothesis threshold
Pre-launch threshold of 5%; observed engagement under 2%.

Alternatives I rejected

Outcome

GA shipped on schedule. Board View replaced the legacy Card View as the default within six months, with views up 43% over Card View. Scoping the problem with a hard constraint up front preserved the sprint buffer for integration risk and edge cases, instead of spending it on infrastructure that telemetry later showed 98% of users did not need.