Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error in megamenu #7678

Closed
QuentinNativel opened this issue Feb 5, 2025 · 1 comment · Fixed by #7679
Closed

Type error in megamenu #7678

QuentinNativel opened this issue Feb 5, 2025 · 1 comment · Fixed by #7679
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@QuentinNativel
Copy link

Describe the bug

In the following code the variable _focusedItemInfo is defined as const but it is reassigned later. It raises an error in the console.
Uncaught TypeError: "_focusedItemInfo" is read-only

//MegaMenu.js line 421
const onArrowDownKey = (event) => {
            event.preventDefault();

            if (horizontal) {
                const _focusedItemInfo = focusedItemInfo; // <-- DECLARED

                if (ObjectUtils.isNotEmpty(activeItemState) && activeItemState.key === focusedItemInfo.key) {
                    _focusedItemInfo = { index: -1, key: '', parentKey: activeItemState.key }; // <-- REASSIGNED
                    setFocusedItemInfo(_focusedItemInfo);
                } ...
        };

Reproducer

No response

System Information

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 PRO 7840U w/ Radeon 780M Graphics
    Memory: 2.05 GB / 7.40 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
  npmPackages:
    primereact: ^10 => 10.9.2 
    react: ^19 => 19.0.0 
    tailwindcss: ^4 => 4.0.3
Browser: firefox

Steps to reproduce the behavior

No response

Expected behavior

No response

@QuentinNativel QuentinNativel added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 5, 2025
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 5, 2025
melloware added a commit to melloware/primereact that referenced this issue Feb 5, 2025
@melloware melloware self-assigned this Feb 5, 2025
@melloware melloware added this to the 10.9.3 milestone Feb 5, 2025
@melloware
Copy link
Member

good catch! Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants