-
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
wp.element - export lazy and Suspense #14412
Conversation
# Conflicts: # packages/element/src/react.js
a2e1458
to
bc38279
Compare
packages/element/src/react.js
Outdated
/** | ||
* Make React Hooks available | ||
* | ||
* @param {function} loadFunction A function that must call a dynamic import(). This must return a Promise which |
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 don't think this was meant to be included 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.
Right, fixed. Not sure why there are unrelated docs changes even after merging master and running npm run docs:build
- am I missing a step?
ps. thanks for reviewing!
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.
running npm run docs:build - am I missing a step?
Can you try it once more? The changes I would have expected with this erroneous DocBlock, but I expect should be largely cleared up if run in the current state of the branch. Would also explain the failing build.
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.
grabbed readme from master, then re-ran - changes in 1466b25.
packages/element/src/react.js
Outdated
* @param {function} loadFunction A function that must call a dynamic import(). This must return a Promise which | ||
* resolves to a module with a default export containing a React component. | ||
*/ | ||
export { lazy }; |
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.
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.
Nice, i updated my PR to use this format in bb22466
# Conflicts: # packages/element/src/react.js
…to add/lazy-suspense # Conflicts: # packages/element/README.md
I update links to use React Top-Level API page.
@TimothyBJacobs do you think that it makes sense to open a follow-up PR with some explanation of how |
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.
@adamsilverstein thanks for this addition 👍
I also updated CHANGELOG file with new API methods exposed. In addition, I included all hooks which weren't fully documented in the last release. See 00fe1c5. |
Yep. This week is a bit hectic, but I can work on something for next week if that helps. |
Description
Add
React.lazy
andReact.suspense
to exports fromwp.element
.Fixes #14155
Testing
Load Gutenberg and check the console for
lazy
andSuspense
onwp.element
.Screenshot
Checklist: