-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
TrueFalse data type's initial value not respected by YesNoPropertyValueConverter #14303
Comments
Hi there @jamiepollock! Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better. We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
Fortunately I think the fix is fairly simple. It would be a case of updating this line: Umbraco-CMS/src/Umbraco.Core/PropertyEditors/ValueConverters/YesNoValueConverter.cs Line 55 in 33adbf4
To something like:
|
I've now added a PR to fix this here: #14305. It looked like my initial code snippet didn't quite cover all the angles. Fortunately the tests project showed me the edge cases I missed. |
While I initially reported this as a v10 bug it likely affects v11 and v12 too as the implementation of YesNoValueConverter has not changed. |
I think this is similar to the issue originally reported by @sebastiandammark: #10160 Back then, a problem in fixing this was that for Umbraco 8, the But as mentioned by @nul800sebastiaan in the original issue, a change like this is seen as a breaking change. So we should we careful about making a change like this. Since this would be a breaking change, I created the Limbo Boolean package so we could have the expected behavior even if it wasn't addressed directly in Umbraco. |
Hi @jamiepollock, Thank you for all your work here 👍 As @abjerner correctly points out, this is a functionally breaking change. The fix would be nice to get in, though, so I'll see if we can include it in V12. |
Closing for now with an explanation added to the PR: #14305 (comment) |
Hey folks. Ah that’s regrettable. I respect the reasoning. Fortunately the PVC system is pluggable so I’ve already replaced the behavior on my project with local code until a core feature is added later on. Thank you for the quick turn around in feedback. |
@nul800sebastiaan In response to this:
Is there any reason this change can't be included in v13 (considering it hasn't been released yet)? Aren't major version changes the right time to make a "breaking" change? Also, I wouldn't say it "works with quirks". People are having to build around this, and they're having to spend time on finding the solution (whether that be a custom fix or using some plugin they aren't initially aware of). It's hard to imagine a scenario where fixing this would break someone's implementation. Can you think of a realistic scenario where it would break their implementation that is remotely likely? My perspective is that the only time we change the output is when the default value configured on the boolean configuration screen is true and, I think, when the property editor is not initially viewable (such as when it's in a settings screen). Given how uncommon that is and how unlikely it is that someone would want the value to be false by default in that situation, it seems like fixing this makes a lot of sense, even if it has to wait for v13. |
@Nicholas-Westby Our deprecation policy is to obsolete things / announce a breaking at least 2 major versions ahead of time v12-RC is out, which means anything we want to break now will need to wait until v14. I didn't emphasize enough on the PR that there are quite a lot of quirks in the various PVCs right now and we'd like to see if we can come up with something coherent for all of them so that workarounds that people have been making for years are no longer necessary. And as noted, there's packages with much more consistent behavior that you can use until then. |
@nul800sebastiaan thanks for this clarification. I agree the PVCs are a useful system to handle quirks and edge cases by the developer themselves or through a package. Hopefully in the future the core PVC system will do a better job at handling these so developer intervention isn't required. |
@nul800sebastiaan I wouldn't say fixing this issue fits within the deprecation policy as this isn't something that is being deprecated, and the upgrade section that mentions breaking changes (if this could even be considered one) doesn't outline anything like the 2 major version announcement you mentioned (i.e., that policy is purely for deprecations). On top of that, it's a very gray area regarding whether or not a release candidate should be considered the cutoff point for a release. In any event, it's good to hear something is being planned to revamp the core PVCs, even if it will be a several years before it will be incorporated into a LTS release (v16 around mid to late 2025, I imagine). |
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
10.5.1
Bug summary
The built in Umbraco TrueFalse data type's initial value prevalue is not respected by the YesnoPropertyValueConverter.
Specifics
I discovered this issue when creating a block list which had a boolean property for visibility in the settings which had an initial state of true.
I noticed if a user did not actively view the settings for the block item that the value would be false instead of the expected true value from the data type prevalues.
Steps to reproduce
Expected result / actual result
Expected
A property which has no CMS provided value should return the data type's configured initial prevalue.
Actual
A property which has no CMS provided value returns false.
The text was updated successfully, but these errors were encountered: