Skip to content

Commit

Permalink
fix: use an empty popover ref to avoid runtime error
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyaaa committed Apr 30, 2024
1 parent 2e30939 commit 89a32ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,20 @@ export default function NobleChainCombobox<T extends object>(
...comboboxProps
} = props;
const { contains } = useFilter({ sensitivity: "base" });
const state = useComboBoxState({ ...comboboxProps, defaultFilter: contains });
const state = useComboBoxState({
...comboboxProps,
defaultFilter: contains,
allowsEmptyCollection: true,
});

const [isFocused, setIsFocused] = React.useState<boolean>(false);
const containerRef = React.useRef(null);
const buttonRef = React.useRef(null);
const inputRef = React.useRef(null);
const listBoxRef = React.useRef(null);
const popoverRef = React.useRef(null);
const [popoverRef] = React.useState<HTMLDivElement>(
document.createElement("div"),
);

const { inputProps, listBoxProps, labelProps } = useComboBox(
{
Expand All @@ -89,7 +95,7 @@ export default function NobleChainCombobox<T extends object>(
inputRef,
buttonRef,
listBoxRef,
popoverRef,
popoverRef: { current: popoverRef },
},
state,
);
Expand Down
4 changes: 4 additions & 0 deletions packages/react/stories/noble/NobleBaseComponents.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export const Primary: Story = {
variant: outlined, size: xl
</NobleButton>

<NobleButton variant="solid" size="lg">
variant: outlined, size: lg
</NobleButton>

<Stack space="$4">
<NobleButton variant="tag" size="xs">
125
Expand Down

0 comments on commit 89a32ab

Please sign in to comment.