How to force reload the mode?

I have an application (playground for my programming language I use CodeMirror 5 as input to type my language (with a few other editors). Now I want to add another CM instance to be able to edit my language mode and load a new version after each change.

So what I need is to reload the mode and refresh the CM that holds my code. How can I do that?

I’ve tried to use this code:'change', debounce(async () => { =;
         await set(CODEMIRROR_FILE,;
         await $.getScript(`./__idb__/${CODEMIRROR_FILE}`);

set is adding the file to the KeyValue store based on IndexedDB and I use a service worker to be able to have static file with new data.

It seems that you can use:

         state.editors.input.setOption('mode', 'text');
         state.editors.input.setOption('mode', 'gaiman');