Skip to content

fix: type.attributes.map is not a function & batch translation #531

Merged
sargreal merged 3 commits intoFekide:nextfrom
breezertwo:fix/batch-translate
Dec 18, 2025
Merged

fix: type.attributes.map is not a function & batch translation #531
sargreal merged 3 commits intoFekide:nextfrom
breezertwo:fix/batch-translate

Conversation

@breezertwo
Copy link
Copy Markdown

@breezertwo breezertwo commented Oct 23, 2025

  • fix: type.attributes.map is not a function ([BUG]: type.attributes.map is not a function #526)
    This comment mentioned the root of the error. The reducer in addTranslationToFields uses {} as inital value. Due to typing issues I could not replace the object with an empty array. Using Objec.values and map instead returns the expected array.

  • fix: batch translation update fails due to empty relations ([BUG]: Batch translation throws error on strapi.document.update (2.0.0-next.3) #532)
    For batch translation we always got an error that the translation failed, but we where seeing that tokens had been used on deepl.
    translateEntity from the translate service threw the error and I could trace it back to strapi.documents(params.contentType).update in this method, which was throwing due to some entries in the cleanedData object where relationName: []. I added a fix to delete all empty arrays from the object before returning it. With this fix, all updates where working correct again.

ℹ️
As our content team was running into these issues with the beta I attempted a fix which is working fine for us. Maybe the fixes can be released as a update for the current next version so others can make use of it, if the fixes are fine and approved. At least somebody may use my fixes as a reference if the need to patch it them selfs.
Let me know if you need any more infos here or feel free to close this PR if is not of use.
Thanks for this awesome plugin.

Copy link
Copy Markdown
Member

@sargreal sargreal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @breezertwo for trying to fix those issues for the new strapi versions!

I believe this is almost ready, just one small fix, related to the unit tests.

Comment thread plugin/server/src/utils/clean-data.ts
Copy link
Copy Markdown
Member

@sargreal sargreal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this!

And sorry for the long wait

@sargreal sargreal merged commit be5c818 into Fekide:next Dec 18, 2025
5 of 12 checks passed
@fekide-bot
Copy link
Copy Markdown

🎉 This PR is included in version 2.0.0-next.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@fekide-bot
Copy link
Copy Markdown

🎉 This PR is included in version 1.3.0-next.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@fekide-bot
Copy link
Copy Markdown

🎉 This PR is included in version 1.2.0-next.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants