Skip to content

Commit

Permalink
Interactivity API: Update preact, @preact/signals and `deepsignal…
Browse files Browse the repository at this point in the history
…` dependencies (#57891)

* Update preact, preact-signals, and deepsignal versions

* Update changelog

* Revert removal of role in wp-bind processing
  • Loading branch information
cbravobernal authored Jan 17, 2024
1 parent 6b224fc commit e7e343c
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 88 deletions.
148 changes: 75 additions & 73 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/interactivity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

- Add the `data-wp-run` directive along with the `useInit` and `useWatch` hooks. ([57805](https://github.com/WordPress/gutenberg/pull/57805))

### Enhancements

- Update `preact`, `@preact/signals` and `deepsignal` dependencies. ([57891](https://github.com/WordPress/gutenberg/pull/57891))

### Breaking Changes

- Remove `data-wp-slot` and `data-wp-fill`. ([#57854](https://github.com/WordPress/gutenberg/pull/57854))
Expand Down
6 changes: 3 additions & 3 deletions packages/interactivity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"react-native": "src/index",
"types": "build-types",
"dependencies": {
"@preact/signals": "^1.1.3",
"deepsignal": "^1.3.6",
"preact": "^10.13.2"
"@preact/signals": "^1.2.2",
"deepsignal": "^1.4.0",
"preact": "^10.19.3"
},
"publishConfig": {
"access": "public"
Expand Down
13 changes: 1 addition & 12 deletions packages/interactivity/src/directives.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { useContext, useMemo, useRef, useLayoutEffect } from 'preact/hooks';
import { useContext, useMemo, useRef } from 'preact/hooks';
import { deepSignal, peek } from 'deepsignal';

/**
Expand Down Expand Up @@ -194,17 +194,6 @@ export default () => {
const attribute = entry.suffix;
const result = evaluate( entry );
element.props[ attribute ] = result;
// Preact doesn't handle the `role` attribute properly, as it doesn't remove it when `null`.
// We need this workaround until the following issue is solved:
// https://github.com/preactjs/preact/issues/4136
useLayoutEffect( () => {
if (
attribute === 'role' &&
( result === null || result === undefined )
) {
element.ref.current.removeAttribute( attribute );
}
}, [ attribute, result ] );

// This seems necessary because Preact doesn't change the attributes
// on the hydration, so we have to do it manually. It doesn't need
Expand Down

0 comments on commit e7e343c

Please sign in to comment.