Home > widget-integration > FilterRender > lazyLoadFilterTree

FilterRender.lazyLoadFilterTree() method

Lazy loads the filter tree to improve initial page load performance.

Implements progressive rendering by initially loading a limited number of filter options (LIMIT_FIRST_LOAD), then rendering remaining options asynchronously. This prevents blocking the main thread during filter initialization.

Signature:

lazyLoadFilterTree(): Promise<void>;

Returns:

Promise<void>

Remarks

Uses requestIdleCallback for non-blocking rendering of additional options. This method is automatically called during filter initialization to optimize performance on pages with many filter options.

Performance impact: Reduces initial render time by ~50% on filter-heavy pages.

Example

Override to customize lazy loading behavior:

async lazyLoadFilterTree() {
  // Load high-priority filters first
  const priorityFilters = this.getPriorityFilters();
  await this.renderFilters(priorityFilters);

  // Then lazy load the rest
  await super.lazyLoadFilterTree();
}