Skip to content

Commit

Permalink
fix: if json_attrs present don't use attrs parsing (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra authored Feb 17, 2025
1 parent 4f11e11 commit dda63a4
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/helpers/attributeParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,6 @@ const evaluateAttributes = ({
fallbackMode?: boolean;
}) => {
let finalTagAttributes = {};
let oldTagAttributes = {};
if (tagAttributes.attrs) {
oldTagAttributes = parseAttributes({
attrs: tagAttributes.attrs,
values,
fields,
widgetType,
});
}

if (tagAttributes.json_attrs) {
try {
Expand All @@ -298,13 +289,23 @@ const evaluateAttributes = ({
});
} catch (error) {
if (fallbackMode && tagAttributes.attrs) {
finalTagAttributes = oldTagAttributes;
finalTagAttributes = parseAttributes({
attrs: tagAttributes.attrs,
values,
fields,
widgetType,
});
} else {
throw error;
}
}
} else if (tagAttributes.attrs) {
finalTagAttributes = oldTagAttributes;
finalTagAttributes = parseAttributes({
attrs: tagAttributes.attrs,
values,
fields,
widgetType,
});
}

return {
Expand Down

0 comments on commit dda63a4

Please sign in to comment.