Page MenuHomePhabricator

Section translation restore fails if the language pair is different from current language pair
Closed, ResolvedPublicBUG REPORT

Description

In the below given context where I have es->en as language pair and have translation in progress for es->en and en->ig., clicking on the en->ig items will throw js error.

image.png (519×690 px, 93 KB)

JS error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getSectionByTitle')
    at startTranslation (CXTranslationWork.vue:114:47)
startTranslation @ CXTranslationWork.vue:114
await in startTranslation (async)
onClick @ CXTranslationWork.vue:132
_createElementBlock.onClick._cache.<computed>._cache.<computed> @ CXTranslationWork.vue:2
callWithErrorHandling @ runtime-core.esm-bundler.js:155
callWithAsyncErrorHandling @ runtime-core.esm-bundler.js:164
invoker @ runtime-dom.esm-bundler.js:369

When I looked at the mediawiki/pages state object, pages corresponding to the titles(for en->ig) present but keyed with 'es' as language. Hence this getter method in mediawiki store fails to get the page.

getPage: (state) => (language, title) =>
   state.pages.find(
     (page) =>
       page.language === language &&
       (page.title === title || (page.alias !== null && page.alias === title))
   ),

Event Timeline

Change 879408 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SX: Move state source/target language update actions to composable

https://gerrit.wikimedia.org/r/879408

Change 879408 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX: Move state source/target language update actions to composable

https://gerrit.wikimedia.org/r/879408

Change 882594 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20230123

https://gerrit.wikimedia.org/r/882594

Change 882594 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 0.2.0+20230123

https://gerrit.wikimedia.org/r/882594

Test status: QA PASS

Unable to reproduce this exception

Pginer-WMF subscribed.

The error seems not to show on the console, however this scenario seems not to be completely supported. Captured the issue on a separate ticket: T333693: In-progress translations from a different language fail to continue