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

Link editing: Account for link anchor no longer being present when generating unique link instance key #36357

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/format-library/src/link/use-link-instance-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ function getKey( _id ) {
* @return {string} the unique key to use for this link control.
*/
function useLinkInstanceKey( instance ) {
if ( ! instance ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be null or a anchorRef. So we need to avoid the null case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a comment above to explicitly state that we're returning a undefined here on purpose?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies @kevin940726, I just missed your comment here before I hit "merge". I was perhaps over-eager to get this fix in, in time for the 11.9 release!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries 👍 , it's more like a nitpick anyway :).

return;
}
if ( weakMap.has( instance ) ) {
return getKey( weakMap.get( instance ) );
}
Expand Down