Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

displayUsing() returns original value if the returned value is 0 #6149

Closed
meyer59 opened this issue Jan 17, 2024 · 1 comment
Closed

displayUsing() returns original value if the returned value is 0 #6149

meyer59 opened this issue Jan 17, 2024 · 1 comment
Labels
bug Verified bug by the Nova team
Milestone

Comments

@meyer59
Copy link

meyer59 commented Jan 17, 2024

Laravel Version: 10.37.3
Nova Version: 4.32.9
PHP Version: 8.2
Database Driver & Version: MYSQL
Operating System and Version: UNIX
Browser type and version: chrome 119.0.6045.124

Description:

I am using the displayUsing to show a computed number. So it's a basic Number field.
The issue is that when the value is 0 the it's returning the original value instead of the Number. My guess is that since the returned value is 0 the callback is treated the same as null and get the original value. Maybe we should do a strict check here to return original value only if returned value is a real NULL

Detailed steps to reproduce the issue on a fresh Nova installation:

Create a Number field with a value different than 0.
Then return 0 in the displayUsing() method. The result will not be zero but the original value

@crynobone crynobone added the bug Verified bug by the Nova team label Feb 12, 2024
@crynobone crynobone added this to the 4.x milestone Feb 13, 2024
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Verified bug by the Nova team
Projects
None yet
Development

No branches or pull requests

2 participants