question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initial Value Empty if initial value is ZERO

See original GitHub issue

Expected Behavior

My initial value is Zero. So I expect to see the value Zero formatted the way I configured it. I expect to see the field like this when I first open the page: image

Actual Behavior

When I first load the page all the values that are initially zero are rendered as empty fields: image

If I click on the field then I get a value zero shown and if I click out of the field (blur) then the zero stays there formatted too. However, if I navigate to another page and get back the value is again gone.

This only happens on values that are ZERO. All other values get correctly displayed initially too. I thought it might have something to do with the default value but that wasn’t the case.

I took a look and thought this might be related to #5 but it seems to be something a bit different.

Specifications

  • Plugin Version: 4.2.1
  • Vue.js Version: 2.6.11
  • Browser: Chrome
  • OS: Linux

Code

Here is the component configuration:

<vue-numeric
          v-model="ebitdaRate"
          decimal-separator=","
          separator="."
          currency="%"
          currency-symbol-position="suffix"
          :precision="2"
          :minus="true"
          class="growth-rate-input"
        />

I am using the vue-class-component so I won’t add the component Java code here, but I can guarantee that this is a reactive field which works correctly updating (set and get).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kevinongkocommented, May 9, 2021

Added the fix in 2.4.2, thanks for the input guys, sorry for the slow response https://github.com/kevinongko/vue-numeric/releases/tag/v2.4.2

2reactions
genughabencommented, May 4, 2021

Good day, I totally need that, too. Would really be a great help, if that could be merged! Thank you so much for all your effort! Have a great day!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Reduce of empty array with no initial value
This error is raised when an empty array is provided because no initial value can be returned in that case.
Read more >
Javascript Reduce an empty array - Stack Overflow
If no initialValue was provided, then previousValue will be equal to the first value in the array and currentValue will be equal to...
Read more >
Default Value in Initial Expression to Null
Default Value in Initial Expression to Null I evaluate my initial expressions to “” when I want the field to be empty.
Read more >
What are the initial/zero values for different data types in ...
1 Answer 1 · internal : empty function, returning initial values (if return is needed) · external : function that throws when called....
Read more >
Default zero values for all Go types - YourBasic
Variables declared without an initial value are set to their zero values: 0 for all integer types,; 0.0 for floating point numbers,; false...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found