tomvanenckevort / Codery.TextCount

Umbraco data type which wraps existing text data type controls and shows text counts and limits while you type.
1 stars 3 forks source link

Configuration stores INT id for DataType- which causes issue on Umbraco Cloud/Deploy transfer #12

Closed hfloyd closed 3 years ago

hfloyd commented 3 years ago

@tomvanenckevort Thanks for your help with the various issues I have been experiencing. Once I had it working beautifully on my local site, I pushed it to my Umbraco Cloud environment, and it broke 😢.

It was trying to "wrap" the wrong DataType on the Cloud environment. I can see that the generated UDA file is storing an INT for the datatype id, whereas a GUID would be better for Cloud/Deploy purposes, since INT Ids vary between environments, but GUIDs do not.:

image

hfloyd commented 3 years ago

I pulled the source code to see if I could make the changes needed for this to work. I see that there are a few things which need to be considered in order to make this update:

  1. The configuration property picker that is used is from your other package (Codery.DataTypePicker) - so in order to return a GUID that would also need to be updated.
  2. Changing the TextCountConfiguration.DataType property from an int to a Guid would cause an issue on upgrade for any existing DataTypes utilizing the package. This leads me to believe that a new version would need to be considered "breaking".

Making the changes would qualify the package as "Umbraco Deploy compatible", but I can understand if this isn't something you'd want to undertake. What are your thoughts?

tomvanenckevort commented 3 years ago

Yes, it does look like a new version would then be breaking, but I might see if there is a way to detect any existing stored values and convert them from an int to Guid to help existing data types when an automatic NuGet upgrade is done.

Either way, I think it's still a good idea to move to Guids, since that really is the recommended way now to reference data types.

hfloyd commented 3 years ago

I was looking at your Codery.DataTypePicker package to see if I could help with making a GUID version of the picker... It appears that the Umbraco-provided Angular resource dataTypeResource doesn't provide a GUID, so a custom API/AJAX resource might be needed here. Would you like me to work on that?

tomvanenckevort commented 3 years ago

I had a quick look this morning and as far as I could see the dataTypeResource does return GUIDs as well (in the key property of each data type), and I already have some working code locally to change that over (while handling existing int values).

I'll try to have a look this weekend to see if I can make the changes for the TextCount package as well.

tomvanenckevort commented 3 years ago

I've now released a new version (v2.1.0) of both the DataTypePicker and TextCount packages that will store the chosen data type's GUID instead of the integer ID. It will still work with the old stored int value, so make sure that after updating the package in your project you go into the data type settings in the CMS and click Save to update the stored value to the GUID instead.

hfloyd commented 3 years ago

Hi @tomvanenckevort , I finally had a chance to look at this again. One thing I noticed - you might need to update the Our page, since it is listing the older version as "current":

image

It installed fine, so this is more "cosmetic" than blocking....

tomvanenckevort commented 3 years ago

@hfloyd Thanks for pointing that out, I've updated the version number now.