Issues triggering Function_v2 from react

Hello everybody! I am trying to trigger a function from an embeded patch in React without success.
As a reference I already read these two links:
Ops.Patch.Function_v2 (from the OP reference list)
External triggers / functions (from the documentation)
And to test it, I am trying to load this example on React (I also tried by updating the function operator to the newer version)

In my react component the patch gets loaded successfully in my useEffect, and it saves it in a useRef variable

const patchRef = useRef(null);

useEffect(() => {
        const script = document.createElement('script');
        script.src = "./js/patch.js";
        script.async = true;
        if (script) {
            patchRef.current = new window.CABLES.Patch(
                patch: window.CABLES.exportedPatch,
                silent: true,

            window.cgl = patchRef.current.cgl

      return () => {
        patchRef.current = null;

    }, [])

The plan was to then call the function via patchRef.current.config.patchFunctiontrigger();
But nothing works. Furthermore, even before I launch the function I get this error message:

index.js:1 ontriggered exception cought TypeError: Cannot read properties of undefined (reading 
 Preformatted text'hasOwnProperty')
        at F (VM34 patch.js:45)
        at V.n.onTriggered (VM34 patch.js:45)
        at V._onTriggered (VM34 patch.js:1)
        at V.trigger (VM34 patch.js:1)
        at V.n.onTriggered (VM34 patch.js:45)
        at V._onTriggered (VM34 patch.js:1)
        at V.trigger (VM34 patch.js:1)
        at Ops.Gl.MainLoop.S [as onAnimFrame] (VM34 patch.js:45)
        at Mt.renderFrame (VM34 patch.js:1)
        at Mt.exec (VM34 patch.js:1)

When I delete the function operator from the patch the error disappear. Could it be that it’s a bug?
Does someone have more experience with functions and external triggers?

What I am looking to achieve for my project is to toggle a boolean value to change an effect from outside the patch. I know you can technically create buttons within Cables html operators, but I want to have the button as a React component and have a function trigger this effect.

Thank you in advance for any input!