-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Interactivity: Ensure ignore directives are stable #60744
Draft
sirreal
wants to merge
6
commits into
trunk
Choose a base branch
from
fix/stable-ignore-directives
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Size Change: +61 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
cbravobernal
added
the
[Type] Code Quality
Issues or PRs that relate to code quality
label
Apr 15, 2024
sirreal
force-pushed
the
fix/stable-ignore-directives
branch
from
April 18, 2024 11:34
eebceb9
to
4634327
Compare
sirreal
force-pushed
the
fix/stable-ignore-directives
branch
from
April 18, 2024 15:20
61fe870
to
6a58170
Compare
Flaky tests detected in 6a58170. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8740537904
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Packages] Interactivity
/packages/interactivity
[Type] Code Quality
Issues or PRs that relate to code quality
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Ensure the ignore directive component is stable.
This requires WordPress/wordpress-develop#6405 or the tests will likely fail. Currently, the server processes directives on tags with
data-wp-ignore
and their descendants.Why?
The
ignore
directive should render a completely stable component, it should provide a DOM element that can be used that will not be rerendered or otherwise changed during its lifecycle. This allows developers to use the rendered DOM to reliably attach other behaviors, such as mounting a React component.It currently renders a component that updates if props change but leaves the
innerHTML
unchanged. It usesuseMemo
to do that, which is documented in react as an optimization that is usually stable, but not reliably so. Preact is less clear about this, but other mechanisms may be better to ensure the stability of the DOM, such definingshouldComponentUpdate => false
as proposed.How?
Change the directive to a class Component with
shouldComponentUpdate(): false
.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast