Skip to content
Discussion options

You must be logged in to vote

After hours I think the problem was a race condition, since the Select component is re-rendered once the async items are loaded but the options elements are not, or something like that. I tested it setting the items static, no async load and no re-render of the components, and it worked. I decided to move the rendering of the options into the select component and omitting the children:

import classNames from "classnames";
import { Ref, forwardRef } from "react";
import inputStyles from "./Input.module.css";

type Props<T> = Omit<JSX.IntrinsicElements["select"], "children"> & {
  isInvalid?: boolean;
  items: T[];
  render: (item: T) => { value: string; display: string };
};

function Sele…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Phibee
Comment options

@emaborsa
Comment options

@lamarovan
Comment options

Answer selected by emaborsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants