-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Preview: skip rendering rich text #60544
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +232 B (0%) Total Size: 1.73 MB
ℹ️ View Unchanged
|
e82dc1d
to
4700624
Compare
disableLineBreaks, | ||
__unstableAllowPrefixTransformations, | ||
readOnly, | ||
...contentProps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if using "opt-in" (listing the content props and omitting the rest) is clearer than "opt-out" here. Also why remove "native props" from preview, aren't these "style related" previews that are important for previews?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do that because we don't know all the possible attributes people could be passing to the tag. I mean, we can't unless we list all possible React props.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok but what about this part "aren't these "style related" previews that are important for previews?"
in other words, why are we calling removeNativeProps
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block authors can pass all sorts of attributes to rich text, it's not just styles. Classes, data attributes, and all other valid HTML attribute names. We are removing native props because these are component props, not attribute names, and otherwise React will throw warnings that these aren't valid attribute names when trying to set them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I got confused by the "native" in the function name. I thought it was about removing regular DOM attributes rather than removing "native like mobile native" RichText version attribute.
I'm a bit unsure about the large swings in the navigate metric. Sometimes it's a fairly large negative, sometimes fairly large positive. Let's merge and see how that metric will be affected in the graph I guess. |
Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
value, | ||
tagName: Tag, | ||
multiline, | ||
format, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ellatrix, is the format
prop used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a very old prop. I believe years ago at the start of GB we had string
and children
. We don't check it anymore, instead we rely on the type of the value (string or array). But we also shouldn't remove this because we'd be spreading it on a plain tag. Maybe it's ok because it's just a React warning in dev mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it; it seems fine to keep it around.
There are no warnings. I was looking into React Native code and noticed this prop, but I wasn't sure if it was used anywhere.
What?
Rich text executes lots of things. Let's see if omitting this from previews makes any improvement.
Why?
templates: -7.67% first run, -6.67% second,
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast