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

Failed prop type: Invalid prop appendTo of type string supplied to DropdownPanel, expected object. #2258

Closed
raDiesle opened this issue Aug 27, 2021 · 0 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@raDiesle
Copy link

raDiesle commented Aug 27, 2021

[x] bug report

  • React version:
    16.13.1

  • PrimeReact version:
    6.5.1

In our automated tests, seems there is some async issue when we migrated to new version of PrimeReact:

Failed prop type: Invalid prop appendTo of type string supplied to DropdownPanel, expected object.
It is not reproducable when application is opened in browser.

This is pseudo code of the failing code:

 const [dropdownOption, setDropdownOptions] = useState([]);
  const intl = useI18nMessage();

  useEffect(() => {
    setDropdownOptions(
      isoCodes.map(code => ({
        key: code,
        label: intl(`${isoCodeTranslationPrefix}${code}`),
      })),
    );
  }, [intl]);
<Dropdown appendTo="self" options={options} value={prefilledValueFromServer}/>

Seems like this is what causes the issue:
It is NOT transforming 'self' to a DOM node, when passed to portal in DropdownPanel

    return <Portal element={element} appendTo={this.props.appendTo} />;

So probably instance of : DomHandler.alignOverlay(this.overlayRef.current, this.input.parentElement, this.props.appendTo || PrimeReact.appendTo); must be passed to DropdownPanel component

Would be nice if you can check

@mertsincan mertsincan self-assigned this Nov 6, 2021
@mertsincan mertsincan added the Type: Bug Issue contains a defect related to a specific component. label Nov 6, 2021
@mertsincan mertsincan added this to the 7.0.0.Final milestone Nov 6, 2021
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

No branches or pull requests

2 participants