Skip to content

When using the component in a React project I (seemingly randomly) get an Uncaught TypeError: f is not a function #10

@mwbouwkamp

Description

@mwbouwkamp

I have created a Mendix widget using the jsme-react component. Sometimes, it seems at random, I get:

Uncaught TypeError: f is not a function
    at index.es.js:137
    at Array.forEach (<anonymous>)
    at window.jsmeOnLoad (index.es.js:136)
    at m (jsme.nocache.js:10)
    at jsme.nocache.js:11
    at l (jsme.nocache.js:7)
    at Function.jsme.onScriptDownloaded (jsme.nocache.js:11)
    at D4DF9EC9DD21B943E35F3D5696D5D2A1.cache.js:1

This is how I am using the component:

<Jsme key={key} width={width} height={height} options={options} smiles={smiles} onChange={onStructureChange} />

  • key is a random number
  • width and height are a string (e.g., "400px")
  • options is a string (e.g., "depict")
  • smiles is the string representation of the structure
  • onChange is a function to update the smiles prop

The function looks like this:

    const onStructureChange = (_smiles: string): void => {
        if (smiles === _smiles) {
            return;
        }
        props.smiles.setValue(_smiles);
    };

When refreshing the page (typically once or twice), the page is working alright. Also, there does not seem to be a clear pattern on when this is happening.

Is this a known issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions