Skip to content

Commit

Permalink
change filterJSON function for correct save/load
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed Feb 2, 2024
1 parent 9e3943f commit 0212fb5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,11 @@ function filterJSONstreet (streetJSON) {
}

let stringJSON = JSON.stringify(streetJSON, function replacer (key, value) {
const compAttributes = AFRAME.utils.styleParser.parse(value);
let compAttributes;
for (var removeKey in removeProps) {
// check for removing components
if (key === removeKey) {
compAttributes = AFRAME.utils.styleParser.parse(value);
const removeVal = removeProps[removeKey];
// check for deleting component's attribute
if (typeof removeVal === 'object' && !isEmpty(removeVal)) {
Expand All @@ -213,7 +214,7 @@ function filterJSONstreet (streetJSON) {
}
}

return compAttributes;
return compAttributes || value;
});
// rename components
for (var renameKey in renameProps) {
Expand Down

0 comments on commit 0212fb5

Please sign in to comment.