TanStack Table version
v8.21.3
Framework/Library version
React 19.1.1
Describe the bug and the steps to reproduce it
I am trying to implement custom server-side column faceting, as suggested in the docs.
So I am getting unique values from the server and expect to plug them into the table by updating getFacetedUniqueValues function, like this:
const [manualFilterValues, setManualFilterValues] = useState(
new Map<string, number>([["placeholder", 1]])
);
// Emulating getting filter values from server
useEffect(
() =>
setManualFilterValues(
new Map<string, number>([
['value1', 1],
['value2', 1],
])
),
[]
);
const table = useReactTable({
...
// Plugging current server filter values into getFacetedUniqueValues
getFacetedUniqueValues: (_table, _columnId) => () => {
return manualFilterValues;
},
});
However, getFacetedUniqueValues seems to be memorized and calling column.getFacetedUniqueValues() only ever returns data from the first render ('placeholder' in this example).
Example from the docs also causes error upon render, as instead of this:
getFacetedUniqueValues: (table, columnId) => {
...
},
getFacetedUniqueValues expects a factory:
getFacetedUniqueValues: (table, columnId) => () => {
...
},
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://stackblitz.com/edit/tanstack-table-rfawoqjm?file=src%2Fmain.tsx
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
Terms & Code of Conduct
TanStack Table version
v8.21.3
Framework/Library version
React 19.1.1
Describe the bug and the steps to reproduce it
I am trying to implement custom server-side column faceting, as suggested in the docs.
So I am getting unique values from the server and expect to plug them into the table by updating
getFacetedUniqueValuesfunction, like this:However,
getFacetedUniqueValuesseems to be memorized and callingcolumn.getFacetedUniqueValues()only ever returns data from the first render ('placeholder' in this example).Example from the docs also causes error upon render, as instead of this:
getFacetedUniqueValuesexpects a factory:Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://stackblitz.com/edit/tanstack-table-rfawoqjm?file=src%2Fmain.tsx
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
Terms & Code of Conduct