fynncfchen/storybook-addon-i18next

Languages are missing in the dropdown

Opened this issue · 0 comments

I also found this problem, but cannot manage to fix it right away so I file an issue here.


In the following image, with a dark background, it is obvious to see that no languages available.

image

However, there is a language provided in my configuration.

withI18next({
  i18n,
  languages: {
    'zh-TW': '繁體中文'
  }
})

Source at: https://github.com/momocow/poi-plugin-tabex/blob/6c60982710dd3fa1c737c550997a321d3e09eb29/.storybook/preview.js#L21-L26
Github Page: https://cow.moe/poi-plugin-tabex/?path=/story/main-tabex--demo-1


It was not always missing, sometimes it just appeared (maybe it's because of HMR of my local dev server triggered the re-render).

After digging a little bit into the source and also putting some logs to trace the issue, I found that CONFIGURE_EVENT_ID was emitted while it was not listened yet, which indicates that decorators may be rendered before the addon panel, says the Tool component, is mounted.

I've tried to fix it using useGlobals() or useParameter() API from @storybook/api instead of the Channel API but without any success. There was always an error arguing about Invalid hook call. Hooks can only be called inside of the body of a function component. even if I called it from a wrapper FC.


Some possible further attempts: