Comments (7)
from umbraco-vorto.
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.
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.
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.
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.
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.
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)
- Examine search failure for keywords after carriage return when textarea editor with vorto
- Feature request - ModelsBuilder in Vorto HOT 2
- Optimisation: Cache language files for Vorto properties HOT 3
- Our.Umbraco.Vorto.Web.PropertyEditors.VortoPropertyEditor+VortoPropertyValueEditor - Error converting DB value to String HOT 6
- umbraco deploy & vorto-ising existing properties HOT 4
- Votro TextString - fallback to show TextString value on website & backoffice HOT 3
- Vorto API cause blocking when many Vorto properties exist on a document type HOT 1
- Vorto with many rich text fields loses content
- Issue in nested content template HOT 2
- Vorto in SurfaceController HOT 6
- Support for Umbraco v8
- GetVortoValue returns null in 1.7.0 version HOT 11
- Dropdowns and checkboxes HOT 4
- GetVortoValue Doesn't Recurse (v1.7.1) HOT 3
- using Vorto in my custom Sections HOT 1
- VortoValueConverter throws NullReferenceException with trashed content/media item HOT 4
- Porting / reimagining for v8
- Suggestion: Split Vorto into two projects HOT 1
- Make the package more strongly typed (generic typed) HOT 1
- Recursive GetVortoValue -> NullReferenceException HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from umbraco-vorto.