devtools icon indicating copy to clipboard operation
devtools copied to clipboard

fix: Payload tab not showing bigints values

Open Fleny113 opened this issue 1 year ago â€ĸ 0 comments

🐛 The bug

When in the Payload tab a state is expanded it fails to show the value with [destr] Invalid JSON if the value is a string representing a BigInt (a number with more than 16/17 digits). When a string representing a BigInt is in an object the entire object is not get showed due to the same destr error

đŸ› ī¸ To reproduce

https://stackblitz.com/edit/github-guforx?file=app.vue

🌈 Expected behavior

The value does get showed and there isn't a destr error throwed in the console

â„šī¸ Additional context

I did attempt to debug the issue myself a bit:

There is a function that checks if the value is a number with a RegExp and if it returned to be a number it gives the value to destr safeDestr which fails to parse the value as the same "is a string with a number" check is done in destr too however with a limit of 16/17 characters, while the check before did not take that into account, making destr return this Invalid JSON error due to the number being "incompatible" with what JSON.parse due to number truncation.

Fleny113 avatar Oct 07 '24 16:10 Fleny113