Skip to content

Uncaught TypeError: t is undefined #255

@jaymzh

Description

@jaymzh

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

When I right click, I get Uncaught TypeError: t is undefined - full stack below.

My code is:

const MENU_ID = 'MyMenu'

const MyThing = ({....}) => {
    const { show } = useContextMenu({
        id: MENU_ID,
    });

    ...

    function handleItemClick({ event, props, triggerEvent, data }){
        console.log(event, props, triggerEvent, data );
    }

    return (
        <div>
            ...
            <Menu id={MENU_ID}>
                <Item onClick={handleItemClick}>One</Item>
                <Item onClick={handleItemClick}>Two</Item>
            </Menu>
            <div onContextMenu={show}><p>some stuff here</p></div>
            ...
        </div>
    )
}

When I right click I get this in console:

22:08:38.790 Uncaught TypeError: t is undefined
    show bundle.js:68203
    show bundle.js:68216
    React 14
    unstable_runWithPriority scheduler.development.js:468
    React 15
    js index.js:7
    factory react refresh:6
    Webpack 3
2 bundle.js:68203:5
    show bundle.js:68203
    show bundle.js:68216
    React 14
    unstable_runWithPriority scheduler.development.js:468
    React 8
    forEach self-hosted:4425
    React 7
    js index.js:7
    factory react refresh:6
    Webpack 3

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

Sure, though I get a slightly different stack trace (X is not a function) on CodeSandbox: https://codesandbox.io/s/react-contexify-issue-255-t6fthr

What is the expected behavior?

It doesn't fail.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Firefox 117 (Linux), CodeSandbox.

React 17.0.2, Contexify 6.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions