|
1 | 1 | import * as Ariakit from "@ariakit/react"; |
2 | 2 | import { type SelectProps as AriaSelectProps } from "@ariakit/react"; |
3 | 3 | import { SelectValue } from "@ariakit/react-core/select/select-value"; |
| 4 | +import { useStoreState } from "@ariakit/react-core/utils/store"; |
4 | 5 | import { Link } from "@remix-run/react"; |
5 | 6 | import * as React from "react"; |
6 | 7 | import { Fragment, useMemo, useState } from "react"; |
@@ -484,7 +485,7 @@ export function SelectItem({ |
484 | 485 | const render = combobox ? <Ariakit.ComboboxItem render={props.render} /> : props.render; |
485 | 486 | const ref = React.useRef<HTMLDivElement>(null); |
486 | 487 | const select = Ariakit.useSelectContext(); |
487 | | - const selectValue = select?.useState("value"); |
| 488 | + const selectValue = useStoreState(select, "value"); |
488 | 489 |
|
489 | 490 | const isChecked = React.useMemo(() => { |
490 | 491 | if (!props.value || selectValue == null) return false; |
@@ -692,8 +693,8 @@ export function ComboBox({ |
692 | 693 | ...props |
693 | 694 | }: ComboBoxProps) { |
694 | 695 | const combobox = Ariakit.useComboboxContext(); |
695 | | - const open = combobox?.useState("open"); |
696 | | - const input = combobox?.useState("baseElement"); |
| 696 | + const open = useStoreState(combobox, "open"); |
| 697 | + const input = useStoreState(combobox, "baseElement"); |
697 | 698 |
|
698 | 699 | React.useEffect(() => { |
699 | 700 | if (!open || !input) return; |
|
0 commit comments