Repository navigation
@ariakit/react@0.3.0
Minor Changes
-
#2714Added support for a dynamicstoreprop on component stores.This is similar to the
storeprop on components, keeping both stores in sync. Now, component store hooks can support modifying the value of thestoreprop after the initial render. For instance:// props.store can change between renders now const checkbox = useCheckboxStore({ store: props.store });
When the
storeprop changes, the object returned from the store hook will update as well. Consequently, effects and hooks that rely on the store will re-run.While it's unlikely, this could represent a breaking change if you're depending on the
storeprop in component stores to only acknowledge the first value passed to it. -
#2783BREAKING (This should affect very few people): Thecomboboxstate onuseSelectStorehas been replaced by thecomboboxproperty on the store object.Before:
const combobox = useComboboxStore(); const select = useSelectStore({ combobox }); const hasCombobox = select.useState("combobox");
After:
const combobox = useComboboxStore(); const select = useSelectStore({ combobox }); const hasCombobox = Boolean(select.combobox);
In the example above,
select.comboboxis literally the same as thecomboboxstore. It will be defined if thecomboboxstore is passed touseSelectStore. -
#2783BREAKING (This should affect very few people): Theselectandmenuprops onuseComboboxStorehave been removed. If you need to composeComboboxwithSelectorMenu, use thecomboboxprop onuseSelectStoreoruseMenuStoreinstead. -
#2717Thechildrenprop as a function has been deprecated on all components. Use therenderprop instead. -
#2717Theasprop has been deprecated on all components. Use therenderprop instead. -
#2717ThebackdropPropsprop has been deprecated onDialogand derived components. Use thebackdropprop instead. -
#2745Component stores will now throw an error if they receive another store prop in conjunction with default prop values.
Patch Changes
-
#2737Fixed controlled component stores rendering with a stale state. -
#2783Component store objects now contain properties for the composed stores passed to them as props. For instance,useSelectStore({ combobox })will return acomboboxproperty if thecomboboxprop is specified. -
#2785Addedparentandmenubarproperties to the menu store. These properties are automatically set when rendering nested menus or menus within a menubar.Now, it also supports rendering nested menus that aren't nested in the React tree. In this case, you would have to supply the parent menu store manually to the child menu store.
These properties are also included in the returned menu store object, allowing you to verify whether the menu is nested. For instance:
const menu = useMenuStore(props); const isNested = Boolean(menu.parent);
-
#2795Updated theMenucomponent so thecompositeandtypeaheadprops are automatically set tofalsewhen combining it with aComboboxcomponent.This means you'll not need to explicitly pass
composite={false}when building a Menu with Combobox component. -
#2796Composed store props such asuseSelectStore({ combobox })now acceptnullas a value. -
Updated dependencies:
@ariakit/react-core@0.3.0.