Fix rating display in filter tags (#5334)

This commit is contained in:
WithoutPants 2024-10-03 11:26:18 +10:00 committed by GitHub
parent 9765b6d50e
commit c92de09ece
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import React, { import React, {
PropsWithChildren, PropsWithChildren,
useCallback, useCallback,
useContext,
useEffect, useEffect,
useMemo, useMemo,
useState, useState,
@ -36,6 +37,7 @@ import {
IItemListOperation, IItemListOperation,
} from "./FilteredListToolbar"; } from "./FilteredListToolbar";
import { PagedList } from "./PagedList"; import { PagedList } from "./PagedList";
import { ConfigurationContext } from "src/hooks/Config";
interface IItemListProps<T extends QueryResult, E extends IHasID> { interface IItemListProps<T extends QueryResult, E extends IHasID> {
view?: View; view?: View;
@ -304,18 +306,20 @@ export const ItemListContext = <T extends QueryResult, E extends IHasID>(
children, children,
} = props; } = props;
const { configuration: config } = useContext(ConfigurationContext);
const emptyFilter = useMemo( const emptyFilter = useMemo(
() => () =>
providedDefaultFilter?.clone() ?? providedDefaultFilter?.clone() ??
new ListFilterModel(filterMode, undefined, { new ListFilterModel(filterMode, config, {
defaultSortBy: defaultSort, defaultSortBy: defaultSort,
}), }),
[filterMode, defaultSort, providedDefaultFilter] [config, filterMode, defaultSort, providedDefaultFilter]
); );
const [filter, setFilterState] = useState<ListFilterModel>( const [filter, setFilterState] = useState<ListFilterModel>(
() => () =>
new ListFilterModel(filterMode, undefined, { defaultSortBy: defaultSort }) new ListFilterModel(filterMode, config, { defaultSortBy: defaultSort })
); );
const { defaultFilter, loading: defaultFilterLoading } = useDefaultFilter( const { defaultFilter, loading: defaultFilterLoading } = useDefaultFilter(