Skip to content

Commit

Permalink
fix(select): recalc height on options changed (#536)
Browse files Browse the repository at this point in the history
* fix(select): recalc height on options changed

* fix(select): virtual-list prevent unused recalc
  • Loading branch information
reme3d2y committed Feb 20, 2021
1 parent 4e85271 commit 4c27c19
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/select/src/components/options-list/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const OptionsList = ({
visibleOptions,
listRef,
open,
invalidate: options.length,
});

if (options.length === 0 && !emptyPlaceholder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const VirtualOptionsList = ({

useVisibleOptions({
visibleOptions,
invalidate: rowVirtualizer.virtualItems.length,
invalidate: listRef.current,
listRef,
styleTargetRef: parentRef,
open,
Expand Down
2 changes: 1 addition & 1 deletion packages/select/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type useVisibleOptionsArgs = {
/**
* Позволяет вызвать пересчет высоты
*/
invalidate?: number;
invalidate?: unknown;
};

export function useVisibleOptions({
Expand Down

0 comments on commit 4c27c19

Please sign in to comment.