padarom / vuepress-plugin-code-switcher

:arrows_clockwise: Component that adds synchronized multi-language code blocks to your Vuepress sites
https://code-switcher.padarom.xyz
MIT License
41 stars 6 forks source link

Groups with missing languages don't select an item #3

Closed padarom closed 4 years ago

padarom commented 4 years ago

Say I have two pages that each use a code switcher with the same name (i.e. they are synced). One of these code switcher has a language that the other one doesn't.

When I select the language that's not available on the other code switcher, it just shows up the picker, but not the content. It doesn't default back to a language that it knows, it just doesn't display any.

To fix this, there should be a check in place when loading the stored language from async storage that makes sure the stored language actually exists in the languages prop. If not, it should just keep the default value (the first item).