convert balance to number before saving #105

Merged
neb-b merged 1 commit from balance into master 2018-12-05 16:59:04 +01:00
2 changed files with 6 additions and 2 deletions

4
dist/bundle.js vendored
View file

@ -4106,7 +4106,9 @@ function doUpdateBalance() {
var _getState = getState(),
balanceInStore = _getState.wallet.balance;
_lbry2.default.account_balance().then(function (balance) {
_lbry2.default.account_balance().then(function (balanceAsString) {
var balance = parseFloat(balanceAsString);
if (balanceInStore !== balance) {
dispatch({
type: ACTIONS.UPDATE_BALANCE,

View file

@ -9,7 +9,9 @@ export function doUpdateBalance() {
const {
wallet: { balance: balanceInStore },
} = getState();
Lbry.account_balance().then((balance) => {
Lbry.account_balance().then((balanceAsString) => {
const balance = parseFloat(balanceAsString);
skhameneh commented 2018-12-03 06:59:22 +01:00 (Migrated from github.com)
Review

I'd use extreme caution with floats, these are not guaranteed to be decimal accurate.

I'd use extreme caution with floats, these are not guaranteed to be decimal accurate.
neb-b commented 2018-12-03 07:03:56 +01:00 (Migrated from github.com)
Review

Recommendations for another approach?

Recommendations for another approach?
if (balanceInStore !== balance) {
dispatch({
type: ACTIONS.UPDATE_BALANCE,