fix: prevent bigint precision loss in structured filter value parsing
When parseFilterValue converts numeric strings to JS Number, integers exceeding Number.MAX_SAFE_INTEGER lose precision (e.g. 2062449923745665025 becomes 2062449923745665024). Keep them as strings so the Rust backend can parse them exactly via serde_json::Number.
This commit is contained in:
parent
120566b1fd
commit
5e21b74487
|
|
@ -52,7 +52,14 @@ export function parseFilterValue(rawValue: string, columnInfo?: Pick<DataGridCol
|
|||
|
||||
if ((isNumericType(dataType) || !dataType) && isNumericLiteral(unquoted)) {
|
||||
const numeric = Number(unquoted);
|
||||
if (Number.isFinite(numeric)) return numeric;
|
||||
if (Number.isFinite(numeric)) {
|
||||
// Keep large integers as strings to avoid JS precision loss (> Number.MAX_SAFE_INTEGER).
|
||||
// The Rust backend parses strings exactly via serde_json::Number, so this is safe.
|
||||
if (Number.isInteger(numeric) && Math.abs(numeric) > Number.MAX_SAFE_INTEGER) {
|
||||
return unquoted;
|
||||
}
|
||||
return numeric;
|
||||
}
|
||||
}
|
||||
|
||||
return unquoted;
|
||||
|
|
|
|||
Loading…
Reference in New Issue