# Function replaceFilter

replaceFilter( dashboard, filterToReplace, newFilter): DashboardProps

Creates a new dashboard instance with a specific filter replaced.

This function searches for a filter with the same GUID as the provided filterToReplace and replaces it with newFilter. This function does not modify the original dashboard; instead, it returns a new dashboard with the updated filters.

# Parameters

Parameter Type Description
dashboard DashboardProps The original dashboard (DashboardProps) containing the filter to be replaced.
filterToReplace Filter The existing filter to be replaced.
newFilter Filter The new filter to replace the existing one.

# Returns

DashboardProps

A new dashboard instance with the specified filter replaced.

# Example

Replace a filter in a dashboard.

const existingDashboard: DashboardProps = {...};
const filterToReplace: Filter = {...};
const newFilter: Filter = {...};
const updatedDashboard = replaceFilter(existingDashboard, filterToReplace, newFilter);