Home > widget-integration > FilterService > syncActiveFiltersToContext

FilterService.syncActiveFiltersToContext() method

Synchronizes active URL filter parameters to FilterStore context.

Parses current URL parameters and updates selectedFilter state to match. Ensures filter UI reflects the actual URL state, especially important after browser back/forward navigation.

Signature:

syncActiveFiltersToContext(): Promise<void>;

Returns:

Promise<void>

Remarks

Called during initialization and after URL changes to keep state synchronized with URL parameters.

Example

Override to add custom filter synchronization:

async syncActiveFiltersToContext() {
  await super.syncActiveFiltersToContext();
  // Sync custom shop-specific filters
  this.syncCustomShopFilters();
}