Skip to content

Conversation

@ahasseyp-paragon
Copy link
Contributor

Issues Closed

  • PARA-15365

Brief Summary

add dynamic custom dropdown support with pagination


export function DynamicCustomDropdownField(props: Props) {
const [searchQuery, setSearchQuery] = useState<string>('');
const { ref, inView } = useInView();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we can use the useOnInView which takes a callback. This would replace the useEffect below

allowClear
>
{allOptions.map((option) => (
<ComboboxField.Item key={option.value} value={option.label}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we using the label as the value prop? This prop is intended to be unique fields. Using the value would remove the allOptions.find above as well

Comment on lines +84 to +96
{hasNextPage && (
<div
ref={ref}
className="flex items-center justify-center py-2 text-sm text-muted-foreground"
>
{isFetchingNextPage && (
<div className="flex items-center gap-2">
<LoaderCircle className="size-4 animate-spin" />
Loading more...
</div>
)}
</div>
)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

niice!!! 👏

Comment on lines +171 to +173
customDropdownLoader={
(customDropdownOptions as CustomDropdownOptions).loadOptions
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think this prop could named as onLoad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants