[V3] Return null on IntSynth when null is passed in #6478
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
IntSynth
in Livewire V3 adds the ability to convert an empty string that's passed into the synth tonull
. This is great on the frontend (since a form input will generally return''
instead ofnull
, but there are still scenarios wherenull
might be returned. For example, in a unit test (as demonstrated in the test on this PR), or when updated though Javascipt.This PR just makes sure we pass though that
null
value in those cases, as opposed to passing it to theint
cast, which converts it to0
.1️⃣ Is this something that is wanted/needed? Did you create a discussion about it first?
Did not create a discussion, but an explanation is included above.
2️⃣ Did you create a branch for your fix/feature? (Master branch PR's will be closed)
Yes
3️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.
The only changes are to the
IntSynth
class, and adding a test for that Synth.4️⃣ Does it include tests? (Required)
Yes
5️⃣ Please include a thorough description (including small code snippets if possible) of the improvement and reasons why it's useful.
Included above :)