Skip to content

Instantly share code, notes, and snippets.

@ddanielsantos
Created November 8, 2022 15:36
Show Gist options
  • Save ddanielsantos/9af0dd3386cb3b43675830d2f0435e3e to your computer and use it in GitHub Desktop.
Save ddanielsantos/9af0dd3386cb3b43675830d2f0435e3e to your computer and use it in GitHub Desktop.
reproduction that triggers Maximum update depth exceeded on ariakit version: 2.0.0-next.41, when using a Combobox inside other two Ariakit components
import {
useSelectState,
Select,
SelectPopover,
SelectItem,
} from 'ariakit/select'
import {
Dialog,
DialogHeading,
DialogDismiss,
useDialogState,
} from 'ariakit/dialog'
import {
Combobox,
useComboboxState,
ComboboxPopover,
ComboboxItem,
} from 'ariakit/combobox'
const onSubmit = () => {}
export function ShippingAddressSelection() {
const select_id = useSelectState()
const dialog = useDialogState()
const combobox = useComboboxState()
return (
<>
<Select state={select_id} />
<SelectPopover state={select_id}>
<SelectItem onClick={dialog.toggle}>toggle dialog</SelectItem>
<Dialog state={dialog}>
<form onSubmit={onSubmit}>
<DialogHeading>do action</DialogHeading>
<label>
input label:
<input name={'input_name'} />
</label>
<div>
<label>
Your favorite fruit
<Combobox state={combobox} placeholder='e.g., Apple' />
</label>
<ComboboxPopover state={combobox}>
<ComboboxItem value='1'>1</ComboboxItem>
</ComboboxPopover>
</div>
<div>
<DialogDismiss>cancel</DialogDismiss>
<button type='submit'>save</button>
</div>
</form>
</Dialog>
<SelectItem value='address 1' />
<SelectItem value='address 2' />
</SelectPopover>
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment