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

Dropdown: warning when using useOptionAsValue #7409

Closed
sujit-baniya opened this issue Nov 12, 2024 · 0 comments · Fixed by #7535
Closed

Dropdown: warning when using useOptionAsValue #7409

sujit-baniya opened this issue Nov 12, 2024 · 0 comments · Fixed by #7535
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@sujit-baniya
Copy link

sujit-baniya commented Nov 12, 2024

Describe the bug

Hi all, I'm using primreact/dropdown. When using useOptionAsValue I'm getting warning from React.

https://primereact.org/dropdown/#api.Dropdown.props.useOptionAsValue

<Dropdown
    value={selectedDate}
    useOptionAsValue
    options={availableDates}
    onChange={(e) => setSelectedDate(e.value)}
    placeholder="Select a DOS"
    className="date-dropdown"
/>
Warning: React does not recognize the `useOptionAsValue` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `useoptionasvalue` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    at div
    at http://localhost:5173/node_modules/.vite/deps/chunk-MAEDPHWQ.js?v=1852453c:809:20
    at div
    at div
    at div
    at main
    at div
    at div
    at div
    at http://localhost:5173/node_modules/.vite/deps/primereact_blockui.js?v=6230d636:178:20
    at CodingBlock (http://localhost:5173/src/app/components/encounters/forms/CodingBlock.tsx?t=1731398116530:78:31)
    at CodingProvider (http://localhost:5173/src/app/hooks/Coding.tsx?t=1731398057470:125:34)

Reproducer

No response

System Information

"primereact": "latest",
		"prop-types": "^15.8.1",
		"qrcode": "^1.5.4",
		"qs": "^6.13.0",
		"react": "^18.3.1",
		"react-dom": "^18.3.1",
		"react-fast-compare": "^3.2.2",
		"react-hook-form": "^7.53.2",

Steps to reproduce the behavior

<Dropdown
    value={selectedDate}
    useOptionAsValue
    options={availableDates}
    onChange={(e) => setSelectedDate(e.value)}
    placeholder="Select a DOS"
    className="date-dropdown"
/>

Expected behavior

There should not have any warning

@sujit-baniya sujit-baniya added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 12, 2024
melloware added a commit to melloware/primereact that referenced this issue Dec 30, 2024
@melloware melloware self-assigned this Dec 30, 2024
@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 Dec 30, 2024
@melloware melloware added this to the 10.8.6 milestone Dec 30, 2024
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