Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion react/src/__rust_generated__/EmbedFilters.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { FilterConfig } from './FilterConfig';
import type { FilterVariableValue } from './FilterVariableValue';
import type { LabelValue } from './LabelValue';

export interface EmbedFilters {
filters: Array<FilterConfig>;
defaultValues: Record<string, FilterVariableValue>;
uniqueValues: Record<string, Array<[string, string]>>;
// uniqueValues: Record<string, Array<[string, string]>>;
uniqueValuesV2: Record<string, Array<LabelValue>>;
}
6 changes: 6 additions & 0 deletions react/src/__rust_generated__/LabelValue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

export interface LabelValue {
label: string;
value: string;
}
7 changes: 3 additions & 4 deletions react/src/filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ const Filter = ({ canvasData, filter }: { canvasData: EmbedResponse; filter: Fil
if (filterOptionsCache) {
return filterOptionsCache;
}
const uniqueValues = canvasData.filters.uniqueValues[storeId];
const uniqueValues = canvasData.filters.uniqueValuesV2[storeId];
if (!uniqueValues) {
return [];
}
const options = uniqueValues.map((option) => ({ label: option[0], value: option[1] }));
setFilterOptionsCache(options);
return options;
setFilterOptionsCache(uniqueValues);
return uniqueValues;
};
const filterOptions = getFilterOptions();
return (
Expand Down