Code Monkey home page Code Monkey logo

Comments (5)

dnwhte avatar dnwhte commented on August 13, 2024 1

👍 it works!

from umbraco-tuple.

leekelleher avatar leekelleher commented on August 13, 2024

Hi @dnwhte!

I've had a quick look at what might be happening here, and it looks that the issue might be this line...

https://github.com/umco/umbraco-tuple/blob/develop/src/Our.Umbraco.Tuple/ValueConverters/TupleValueConverter.cs#L77-L79

...where it's trying to convert the inner property value (from ConvertDataToSource) to the ClrType.

Which in the case of FlexibleDropdownPropertyValueConverter, that would be a string...

https://github.com/umbraco/Umbraco-CMS/blob/release-7.15.3/src/Umbraco.Core/PropertyEditors/ValueConverters/FlexibleDropdownPropertyValueConverter.cs#L64

...but the ConvertDataToSource method has literally just returned a string[]...

https://github.com/umbraco/Umbraco-CMS/blob/release-7.15.3/src/Umbraco.Core/PropertyEditors/ValueConverters/FlexibleDropdownPropertyValueConverter.cs#L31-L36

...so Tuple code doesn't cast/convert it to the correct type, so when the subsequent ConvertSourceToObject calls are made, it's the wrong type.

That's my (educated) guess at least - I haven't tested this out.


Are you building/running Tuple from source? Would you be willing to try out modifying these lines?

https://github.com/umco/umbraco-tuple/blob/develop/src/Our.Umbraco.Tuple/ValueConverters/TupleValueConverter.cs#L77-L79

It'd be to ignore the TryConvertTo bit and set the itemSource value directly.

e.g.

item.Value = itemSource;

from umbraco-tuple.

leekelleher avatar leekelleher commented on August 13, 2024

@dnwhte Cool. (phew!) I'll close off this ticket. Feel free to send over a PR whenever you have time. 👍

from umbraco-tuple.

dnwhte avatar dnwhte commented on August 13, 2024

Will submit a PR.

Because I don't fully understand how this is working, is this a reliable solution or just a band-aid?

from umbraco-tuple.

leekelleher avatar leekelleher commented on August 13, 2024

It's reliable, previously it was a bug. That method should return the "source" values, not the end target "object types".

from umbraco-tuple.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.