Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setValueOnMove state on Select not syncing between connected stores #2858

Merged
merged 2 commits into from Sep 21, 2023

Conversation

diegohaz
Copy link
Member

@diegohaz diegohaz commented Sep 21, 2023

This PR fixes the setValueOnMove state on the Select module not syncing between multiple stores.

The following now works as expected:

const store1 = useSelectStore();
const store2 = useSelectStore({ store: store1, setValueOnMove: true });

store1.useState("setValueOnMove") === store2.useState("setValueOnMove"); // true

@changeset-bot
Copy link

changeset-bot bot commented Sep 21, 2023

🦋 Changeset detected

Latest commit: efd5826

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@ariakit/react-core Patch
@ariakit/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Sep 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ariakit ✅ Ready (Inspect) Visit Preview Sep 21, 2023 3:35pm
1 Ignored Deployment
Name Status Preview Updated (UTC)
reakit ⬜️ Ignored (Inspect) Visit Preview Sep 21, 2023 3:35pm

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 21, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit efd5826:

Sandbox Source
Ariakit Configuration

@diegohaz diegohaz merged commit 662742f into main Sep 21, 2023
14 checks passed
@diegohaz diegohaz deleted the select-sync-set-value-on-move branch September 21, 2023 15:54
This was referenced Sep 21, 2023
diegohaz pushed a commit that referenced this pull request Sep 26, 2023
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @ariakit/react@0.3.3

### Patch Changes

- [`#2820`](#2820) Added missing
`aria-haspopup` attribute to
[`DialogDisclosure`](https://ariakit.org/reference/dialog-disclosure)
and
[`PopoverDisclosure`](https://ariakit.org/reference/popover-disclosure).

- [`#2858`](#2858) Fixed the
[`setValueOnMove`](https://ariakit.org/reference/use-select-store#setvalueonmove)
state on the [Select](https://ariakit.org/components/select) module not
syncing between multiple stores.

    The following now works as expected:

    ```js
    const store1 = useSelectStore();
const store2 = useSelectStore({ store: store1, setValueOnMove: true });

store1.useState("setValueOnMove") === store2.useState("setValueOnMove");
// true
    ```

- [`#2862`](#2862) Elements
inside [Dialog](https://ariakit.org/components/dialog) and derived
components are now properly disabled when the dialog is animating out.

- [`#2862`](#2862) Fixed a bug
that occurred when rendering nested
[Dialog](https://ariakit.org/components/dialog) elements with a
third-party dialog interspersed.

Previously, Ariakit didn't recognize the third-party dialog as a nested
dialog when the lowest dialog opened.

- [`#2862`](#2862) The
[`hideOnEscape`](https://ariakit.org/reference/dialog#hideonescape) prop
is now triggered during the capture phase.

Essentially, this means that you can now prevent the propagation of the
<kbd>Escape</kbd> keydown event to other elements in the DOM when it's
used to close an Ariakit
[Dialog](https://ariakit.org/components/dialog):

    ```jsx
    <Dialog
      hideOnEscape={(event) => {
        event.stopPropagation();
        return true;
      }}
    />
    ```

- [`#2862`](#2862) Fixed an issue
where the [Dialog](https://ariakit.org/components/dialog) component
would automatically hide when parent dialogs closed.

You can now render nested dialogs in the React tree and keep them open
independently, provided they're not unmounted.

- [`#2862`](#2862) Fixed the
[Focusable](https://ariakit.org/components/focusable) and its derived
components that were incorrectly calling the
[`onFocusVisible`](https://ariakit.org/reference/focusable#onfocusvisible)
callback prop when the element had lost focus.

This didn't align with the behavior of the
[`data-focus-visible`](https://ariakit.org/guide/styling#data-focus-visible)
attribute. The behavior now mirrors the attribute, which will only be
omitted from the element if `event.preventDefault()` is invoked from
within the
[`onFocusVisible`](https://ariakit.org/reference/focusable#onfocusvisible)
callback.

- [`#2862`](#2862) The
[`modal`](https://ariakit.org/reference/menu#modal) prop is now
automatically disabled on nested
[`Menu`](https://ariakit.org/reference/menu) components.

- [`#2869`](#2869) Fixed uncaught
`msg.startsWith` error.

-   Improved JSDocs.

-   Updated dependencies: `@ariakit/react-core@0.3.3`.

## @ariakit/react-core@0.3.3

### Patch Changes

- [`#2820`](#2820) Added missing
`aria-haspopup` attribute to
[`DialogDisclosure`](https://ariakit.org/reference/dialog-disclosure)
and
[`PopoverDisclosure`](https://ariakit.org/reference/popover-disclosure).

- [`#2858`](#2858) Fixed the
[`setValueOnMove`](https://ariakit.org/reference/use-select-store#setvalueonmove)
state on the [Select](https://ariakit.org/components/select) module not
syncing between multiple stores.

    The following now works as expected:

    ```js
    const store1 = useSelectStore();
const store2 = useSelectStore({ store: store1, setValueOnMove: true });

store1.useState("setValueOnMove") === store2.useState("setValueOnMove");
// true
    ```

- [`#2862`](#2862) Renamed
`@ariakit/react-core/dialog/utils/disable-tree-outside` module to
`@ariakit/react-core/dialog/utils/disable-tree`.

- [`#2862`](#2862) Elements
inside [Dialog](https://ariakit.org/components/dialog) and derived
components are now properly disabled when the dialog is animating out.

- [`#2862`](#2862) Fixed a bug
that occurred when rendering nested
[Dialog](https://ariakit.org/components/dialog) elements with a
third-party dialog interspersed.

Previously, Ariakit didn't recognize the third-party dialog as a nested
dialog when the lowest dialog opened.

- [`#2862`](#2862) The
[`hideOnEscape`](https://ariakit.org/reference/dialog#hideonescape) prop
is now triggered during the capture phase.

Essentially, this means that you can now prevent the propagation of the
<kbd>Escape</kbd> keydown event to other elements in the DOM when it's
used to close an Ariakit
[Dialog](https://ariakit.org/components/dialog):

    ```jsx
    <Dialog
      hideOnEscape={(event) => {
        event.stopPropagation();
        return true;
      }}
    />
    ```

- [`#2862`](#2862) Fixed an issue
where the [Dialog](https://ariakit.org/components/dialog) component
would automatically hide when parent dialogs closed.

You can now render nested dialogs in the React tree and keep them open
independently, provided they're not unmounted.

- [`#2862`](#2862) Fixed the
[Focusable](https://ariakit.org/components/focusable) and its derived
components that were incorrectly calling the
[`onFocusVisible`](https://ariakit.org/reference/focusable#onfocusvisible)
callback prop when the element had lost focus.

This didn't align with the behavior of the
[`data-focus-visible`](https://ariakit.org/guide/styling#data-focus-visible)
attribute. The behavior now mirrors the attribute, which will only be
omitted from the element if `event.preventDefault()` is invoked from
within the
[`onFocusVisible`](https://ariakit.org/reference/focusable#onfocusvisible)
callback.

- [`#2862`](#2862) The
[`modal`](https://ariakit.org/reference/menu#modal) prop is now
automatically disabled on nested
[`Menu`](https://ariakit.org/reference/menu) components.

- [`#2869`](#2869) Fixed uncaught
`msg.startsWith` error.

-   Improved JSDocs.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant