document-internationalization
document-internationalization copied to clipboard
Desk tool crashed when 0 translations remain
When manually attempting to fix a translation association, we ended up with a translations.metadata document with 0 translations. This caused the Desk tool to crash, and as a result the issue cannot be resolved.
Error: undefined is not an object (evaluating 'translations.length')
DeleteMetadataAction@.../node_modules/.sanity/vite/deps/@sanity_document-internationalization.js:7290:36
HookStateContainer2@.../node_modules/.sanity/vite/deps/chunk-QYVNDX4Z.js:74462:25
renderWithHooks@.../node_modules/.sanity/vite/deps/chunk-CG7IQCDB.js:12171:35
This occurs with sanity v3.11.5 and document-internationalization v2.0.0
I can imagine that this issue only occurs through manual intervention in Translation metadata, however, there is no way to escape this state.
Also get a similar error when deleting both translations from the Translations > Manage Translations panel:
Error: Cannot read properties of undefined (reading 'length')
Same here.
Also get a similar error when deleting both translations from the Translations > Manage Translations panel:
Error: Cannot read properties of undefined (reading 'length')
I also get this issue when I have no translations.metadata document with 0 translations. There is no way to get in and delete the metadata or add a translation.
This either happens when I remove a translation, or when I select a document type with no documents selected under translations
Same!
Same here
+1
@LiamMartens @SimeonGriggs the issue still exists.
@LiamMartens @SimeonGriggs the issue still exists:
@sanity/document-internationalization v2.0.1, sanity v3.17.0
this issue still exists, how to solve it?
Just got into the same issue while setting up translations for a new site. Would really appreciate a way to get out of this error other than making a new dataset.
Hello everyone, for more help and workarounds we usually send people to our community. Since I have a small script you can use to get the meta translation documents without references set and delete them, here is what you can do:
client
.delete({query: "*[_type == 'translation.metadata' && !defined(translations)]"})
.then(() => {
console.log('The document matching the query were deleted')
})
.catch((err) => {
console.error('Delete failed: ', err.message)
})
afterwards you will be unblocked again :)
Hello everyone, for more help and workarounds we usually send people to our community. Since I have a small script you can use to get the meta translation documents without references set and delete them, here is what you can do:
client .delete({query: "*[_type == 'translation.metadata' && !defined(translations)]"}) .then(() => { console.log('The document matching the query were deleted') }) .catch((err) => { console.error('Delete failed: ', err.message) })afterwards you will be unblocked again :)
Thank you! It worked great.
this issue still exists, I don't find a way to fix it.
Hello everyone, for more help and workarounds we usually send people to our community. Since I have a small script you can use to get the meta translation documents without references set and delete them, here is what you can do:
client .delete({query: "*[_type == 'translation.metadata' && !defined(translations)]"}) .then(() => { console.log('The document matching the query were deleted') }) .catch((err) => { console.error('Delete failed: ', err.message) })afterwards you will be unblocked again :)
I'm pretty new to Sanity, where do I put this code? I also noticed that when I delete a certain model, the translations will still be floating around.