Remove the papercuts for frontend rendering (PropertyValueConverters and beyond) #10390
Replies: 4 comments 6 replies
-
Ah I see there's one from @ronaldbarendse as well: |
Beta Was this translation helpful? Give feedback.
-
I don't know how relevant this v7 one from @Jeavon is any more: |
Beta Was this translation helpful? Give feedback.
-
Predominantly over the years the number one confusion I see people running into is how to test if something is empty or null... (or if the property has been added) ... eg HasValue and HasProperty were useful for this (when using IPublishedContent and stringly typed models) but it's less clear with Modelsbuilder? HasValue doesn't always work for more complex editors, eg the grid, where if a previously used grid is cleared in the backoffice it can still have json residing in it... and still appear to 'have a value' when it doesn't Additionally, I see lots of code testing whether an integer is null, instead of > 0, Anyway it's a bit of a mismatch of helpers and .net things that differ from one property to another... and I'm thinking it would be easier if there was a consistency between each property and the experience of accessing the data, or checking if it's safe to do so... ... is that the kind of thing you are talking about? |
Beta Was this translation helpful? Give feedback.
-
Helpers for frontend renderingTo make it easier to render Umbraco specific content, we can ship with HTML helper extension methods (and in v9 with ASP.NET Core Tag Helpers, like https://github.com/umbraco-community/Our-Umbraco-TagHelpers). I've already created 2 PRs that make it easier to render Nested Content, Block List and Multi URL Picker/Link items:
Property value convertersI think we should give all default PVCs a good review/clean-up/refactor, as there are quite a lot of issues with correctly converting the values (like throwing exceptions, causing front-end pages to error out), multiple PVCs being registered for the same editor in different assemblies (that are not replaced/shadowed in the recommended way), the source/intermediate/object value types sometimes being different based on configuration/editor value, XPath querying being fundamentally broken for some editors and some PVCs that already lookup data that then isn't exposed (and would require manual re-querying):
Having a generic base class for the PVCs will certainly help with some of the exceptions and ensuring the return types are consistent. But I also think the registration part should be simplified, as we've repeatedly made the same mistake with the Property editorsBesides PVCs (for the front-end rendering part), there's also some work we can do on the property/data editors themselves:
Or possibly merge some of the functionalities into fewer editors if that makes sense:
Other random relatedLastly, I wanted to highlight these items, as they are all beneficial to front-end rendering as well: |
Beta Was this translation helpful? Give feedback.
-
Umbraco version
v9
Description
Over the years we've not been really good at paying attention to make frontend rendering of different datatypes a consistent experience leading to quite a few papercuts over time. Anything can easily be worked around of course but wouldn't it be great if everything "just" worked like you would expect it to.
It's always painful to have to close these issues and patiently explain that we're stuck with this wonky behavior. 😓
We have an opportunity now with the upcoming v9 to do something about it. Why not in v8? Well, all of these changes will introduce breaking changes for people relying on the current behavior. So each of the things listed below would be a breaking change to a significant amount of people.
With v9, people will have to rewrite their views anyway, so why not take the opportunity to make it more consistent!
This work doesn't really fit into the HQ roadmap, so we are seeking assistance from contributors in 2 areas:
To get us started, I've been looking into all the issues we had to close because fixing them would mean a behavioral breaking change.
/ Existing instances are not updated if property (True/false) with default true is added to existing documenttype Existing instances are not updated if property (True/false) with default true is added to existing documenttype #9649
I am not too sure about this one, haven't investigated yet: Textarea Macro Parameter Not Rendering HTML Markup #6286
Then there's also the package
SuperValueConverters
by @callumbwhyte: https://our.umbraco.com/packages/developer-tools/supervalueconverters/. That package works with:So what else is missing from this list?
For each item, can we agree what the correct behavior should be, so we can work on it for the upcoming v9?
Let's discuss!
Beta Was this translation helpful? Give feedback.
All reactions