Switching between plaintext and a language throws error

Hello,

I am trying to give users an option to switch between plaintext and a language as many times as they want. In order to do this, I am using an empty compartment that will be reconfigured with a language when they select it from a dropdown. However, when I dispatch the reconfigured compartment, I get the following error:

Cannot read property 'parser' of null

This error makes sense, but I’m not sure if there is a better way to switch back and forth between plaintext and a language. I’ve also tried adding on the compartment afterwards using StateEffect.appendConfig but that throws the same error.

Here is a minimal reproduction. If you click the “JavaScript” radio button you will see the error.

Should I make an empty language extension for plaintext? I’m trying to avoid recreating the state.

Thanks for your help!

1 Like

Hi. No, that was definitely a bug in the library. I’ve fixed it in this patch.

1 Like

Thank you very much!

@wdcryer Oh! thanks for sharing this post with us. I had this error from so many days. I also type bug like this. Thanks man for making my correction. :slightly_smiling_face:

1 Like