diff --git a/packages/firecms_core/src/components/common/useDataSourceTableController.tsx b/packages/firecms_core/src/components/common/useDataSourceTableController.tsx index 9e9d45a3d..29da3965c 100644 --- a/packages/firecms_core/src/components/common/useDataSourceTableController.tsx +++ b/packages/firecms_core/src/components/common/useDataSourceTableController.tsx @@ -331,6 +331,11 @@ function encodeFilterAndSort(filterValues?: FilterValues, sortBy?: [stri } else if (val instanceof EntityReference) { encodedValue = encodeRef(val); } + } else if (typeof val === "string") { + // JSON.stringify wraps the string in quotes (e.g. "4" → '"4"') + // so that decodeString's JSON.parse restores the string type, + // not a number. Without this, "4" round-trips as the number 4. + encodedValue = JSON.stringify(val); } } catch (e) { encodedValue = val;