Giter Club home page Giter Club logo

Comments (7)

mattbrailsford avatar mattbrailsford commented on June 2, 2024

from umbraco-vorto.

ryanology avatar ryanology commented on June 2, 2024

1.5.1 with Umbraco 7.4.1.
On Mar 16, 2016 6:25 PM, "Matt Brailsford" [email protected] wrote:

What version of Vorto are you using?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#43 (comment)

from umbraco-vorto.

StephenWRogers avatar StephenWRogers commented on June 2, 2024

I've got a similar issue - values in the db with multiple dtdGuid entries and no values.

Using 1.5.1 with Umbraco 7.4.1

From what I can see when saving an empty property lines 189 - 198 of vorto.js will check for empty values and strip them out.

var cleanValue = {};
_.each($scope.languages, function(language) {
    if ($scope.model.value.values[language.isoCode] && JSON.stringify($scope.model.value.values[language.isoCode]).length > 0) {
        cleanValue[language.isoCode] = $scope.model.value.values[language.isoCode];
    }
});
$scope.model.value.values = !_.isEmpty(cleanValue) ? cleanValue : undefined;

So you end up with

$scope.model.value.values = undefined;

This is posted as the following with no values attribute

{"id":223764,"alias":"keywords","value":{"dtdGuid":"125aed02-61e0-4431-b272-5a6525786f4b"}}

This also causes problems when read back out - line 140 of VortoPropertyEditor.cs is

var keys = value.Values.Keys.ToArray();

where value.Values will == null

It seems like the second time you submit an empty box you end up with the multiple dtdGuid entries - but I've not looked too much into that yet.

Not sure the purpose of setting $scope.model.value.values to undefined as far as how to fix it?

Stephen

from umbraco-vorto.

ryanology avatar ryanology commented on June 2, 2024

Hey Matt,

Just wondering if you were able to replicate this or if you have found any resolution. I currently have some custom data resolvers for Courier that this is messing with because of the null values.

Thanks

from umbraco-vorto.

StephenWRogers avatar StephenWRogers commented on June 2, 2024

I have tried changing line 197 in vorto.js to

$scope.model.value.values = !_.isEmpty(cleanValue) ? cleanValue : {};

and some very light testing seems to have it working better and not corrupting the values. Not sure I'm confident enough in it to submit a PR, but it's working for me at the moment

That's not going to fix the data already in the DB though, seems like that's going to need cleaned up manually.

Stephen

from umbraco-vorto.

mattbrailsford avatar mattbrailsford commented on June 2, 2024

Sorry guys, I've been absolutely stacked recently so haven't had chance to look into it yet. I'll try and find some time tomorrow to take a look. Do post any other comments you have / code tweaks you have as it'll make it much easier for me to diagnose the issue.

from umbraco-vorto.

mattbrailsford avatar mattbrailsford commented on June 2, 2024

Ok, I think I've fixed the issue. It's not really a problem having the JS store undefined in the DB, and in fact I do this on purpose to minimise the amount of data in the db (why store "{}" when you can store "").

I've made a couple of changes though which are 1) standardise the spelling of dtdGuid so that only 1 attribute is saved and 2) added null checks within VortoValueConverter to no bother trying to deserialize the inner values if there are no inner values to deserialize. The HasVortoValue and GetVortoValue methods should already be checking for null, so you shouldn't have a problem there (although I have added another explicit null check in those to be safe).

If you wanna give the nightly a try and let me know if it solves your issues? https://ci.appveyor.com/project/mattbrailsford/umbraco-vorto/build/artifacts

Matt

from umbraco-vorto.

Related Issues (20)

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.