Skip to content

Commit d7c13ca

Browse files
committedNov 18, 2021
fix: Harvest Konnector translation
Relying on of non "lifecycled" react variable is pretty always a bad idea. Here, we have a bad sync between runtime variable and react state. Now the I18n stuff is unmounted when we close the Modal, but we didn't remove the konnector from the already loaded konnector. The result was that when we opened again the modal after having closing it once we didn't have the right translation. Let's remove this stuff.

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed
 

‎packages/cozy-harvest-lib/src/components/hoc/withKonnectorLocales.jsx

-11
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ import { extend } from 'cozy-ui/transpiled/react/I18n'
55

66
import { getDisplayName } from './utils'
77

8-
/**
9-
* Index of konnectors which locales have already extended the I18n.
10-
* For now we are not supposed to update konnector locales at runtime and we
11-
* should just load them once for all.
12-
*/
13-
const loadedKonnectors = []
14-
158
/**
169
* HOC which ensures that a component get extended I18n with locales data from
1710
* konnector manifest.
@@ -21,15 +14,11 @@ export const withKonnectorLocales = Component => {
2114
constructor(props, context) {
2215
super(props, context)
2316
const { konnector, lang } = this.props
24-
if (loadedKonnectors.includes(konnector.slug)) return
25-
2617
const { locales } = konnector
2718
if (locales && lang) {
2819
extend(locales[lang])
29-
loadedKonnectors.push(konnector.slug)
3020
}
3121
}
32-
3322
render() {
3423
return <Component {...this.props} />
3524
}

0 commit comments

Comments
 (0)
Please sign in to comment.