Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScriptAttribute fix (#6750) #7192

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/framework/script/script-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,18 @@ function attributeToValue(app, schema, value, current) {
*/
export function assignAttributesToScript(app, attributeSchemaMap, data, script) {

if (!data) return;

// Iterate over the schema and assign corresponding data
for (const attributeName in attributeSchemaMap) {
const attributeSchema = attributeSchemaMap[attributeName];
const dataToAssign = data[attributeName];

// Skip if the data is not defined
if (dataToAssign === undefined) continue;

// Assign the value to the script based on the attribute schema
script[attributeName] = attributeToValue(app, attributeSchema, dataToAssign, script);
script[attributeName] = attributeToValue(app, attributeSchema, dataToAssign, script[attributeName]);
}
}

Expand All @@ -204,6 +209,8 @@ export function assignAttributesToScript(app, attributeSchemaMap, data, script)
class ScriptAttributes {
static assignAttributesToScript = assignAttributesToScript;

static attributeToValue = attributeToValue;

/**
* Create a new ScriptAttributes instance.
*
Expand Down
Loading