leekelleher / umbraco-contentment

Contentment for Umbraco - a state of happiness and satisfaction
https://marketplace.umbraco.com/package/umbraco.community.contentment
Mozilla Public License 2.0
155 stars 70 forks source link

Renaming data source break existing in datatype configuration #102

Closed bjarnef closed 3 years ago

bjarnef commented 3 years ago

What is the current behaviour?

When renaming a data source e.g. from MembersDataSource to StaffMembersDataSource it seems it breaks the existing configuration on the datatype.

By renaming I mean the class name and the contructor name.

image

What is the expected behaviour?

The data source is of course not available anymore, but it woud be nice it failed gracefully, so you just could select to new renamed data source.

A workaround for now it to create a new datatype instance with the renamed data source and then swap the property on a document type to use the new datatype instance and then delete the old datatype.

Please tell us about your set-up:

leekelleher commented 3 years ago

@bjarnef Thanks for raising this, but I'm going to mark it as 'wont-fix'. The configuration editor is using the class's full assembly name as the key, so renaming the class breaks that connection. The alternatives could be to use a GUID or an alias, but again, changing one of those values would have the same effect.

Weighing up how often this would occur for a developer, against the amount of development work to make it a nicer experience doesn't add up for me. (I might think differently if this was a commercial product, but it isn't that).

As a workaround (if it happens again in future) - I'm not sure if you've seen the "Edit raw JSON" option on the Property Actions? That will open up the JSON for the configuration, then editing the key would make it work again. (As opposed to creating a new Data Type and swapping the DocType's property).

bjarnef commented 3 years ago

@leekelleher it is fine the class breaks the connection, but could it somehow catch this, so the angular/javascript doesn't break and I could just pick the new/another data source? E.g. show an error message instead while having an picker to select/change to data source? Currently it requires to delete the datatype instance and re-create a new datatype.

leekelleher commented 3 years ago

Good point. I'll have a think on how to display an error/warning message.