added check to update ownNeed state if the need is present but is later determined to be an ownNeed (for example when a page reload happens on the post view)
@@ -140,12 +140,17 @@ function addNeed(needs, jsonldNeed, ownNeed) {
let parsedNeed = parseNeed(jsonldNeed, ownNeed);
if(parsedNeed && parsedNeed.get("uri")) {
+ if(ownNeed && needs.get(parsedNeed.get("uri"))){ //If need is already present and the need is claimed as an own need we set have to set it
+ newState = needs.setIn(["needs", parsedNeed.get("uri"), "ownNeed"], ownNeed);
+ }else{
newState = setIfNew(needs, parsedNeed.get("uri"), parsedNeed);
+ }
} else {
console.error('Tried to add invalid need-object: ', jsonldNeedImm);
newState = needs;
}
+
return newState;
}
