Skip to content

Commit

Permalink
Merge pull request #95 from lcnetdev/fix-class-item-portion-sticking
Browse files Browse the repository at this point in the history
Fix class item portion sticking
  • Loading branch information
f-osorio authored Oct 23, 2024
2 parents 7f4480d + 3592a4a commit 0d57203
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/stores/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,17 @@ export const useProfileStore = defineStore('profile', {
pt = utilsProfile.returnPt(this.activeProfile,componentGuid)
cachePt[componentGuid] = pt
}

//clear the cache if the value was deleted
if (value.trim() == ""){
if (Object.keys(cachePt).includes(componentGuid)){
delete cachePt[componentGuid]
}
for (let guid of Object.keys(cacheGuid)){
cleanCacheGuid(cacheGuid, JSON.parse(JSON.stringify(pt.userValue)), guid)
}
}

// console.log("--------pt 1------------")
// console.log(JSON.stringify(pt,null,2))
// let pt = utilsProfile.returnPt(this.activeProfile,componentGuid)
Expand Down Expand Up @@ -1492,17 +1503,10 @@ export const useProfileStore = defineStore('profile', {
blankNode[lastProperty] = true
// console.log("--------pt 4------------")
// console.log(JSON.stringify(pt,null,2))


}

// console.log("currentValueCount",currentValueCount)



}


if (!blankNode[lastProperty]){
console.error('Trying to find the value of this literal, unable to:',componentGuid, fieldGuid, propertyPath, value, lang, pt)
}
Expand All @@ -1517,16 +1521,13 @@ export const useProfileStore = defineStore('profile', {

// and now add in the literal value into the correct property
blankNode[lastProperty] = value

// if we just set an empty value, remove the value property, and if there are no other values, remvoe the entire property
if (value.trim() === ''){


delete blankNode[lastProperty]



let parent = utilsProfile.returnPropertyPathParent(pt,propertyPath)

if (parent && parent[lastProperty]){
let keep = []
if (parent[lastProperty].length>0){
Expand All @@ -1540,7 +1541,6 @@ export const useProfileStore = defineStore('profile', {
}
}


parent[lastProperty] = keep

if (parent[lastProperty].length==0){
Expand All @@ -1561,6 +1561,7 @@ export const useProfileStore = defineStore('profile', {
propertyPath.pop()
let uv = pt.userValue
let oldUv = pt.userValue

for (let p of propertyPath){
uv = uv[p.propertyURI]
if (Array.isArray(uv)){
Expand All @@ -1574,6 +1575,7 @@ export const useProfileStore = defineStore('profile', {
}

console.log(p.propertyURI,'has',Object.keys(uv).length,'keys')

// the oldUv so we have a references to where we will be in the next loop so we can delete from the parent obj
oldUv = oldUv[p.propertyURI]
if (Array.isArray(oldUv)){
Expand Down

0 comments on commit 0d57203

Please sign in to comment.