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

Add note to indicate why priority queue callbacks may be undefined #28337

Merged
merged 6 commits into from Feb 10, 2021

Conversation

glendaviesnz
Copy link
Contributor

@glendaviesnz glendaviesnz commented Jan 20, 2021

Description

In the Gallery block refactor, in some instances a callback is not defined in the waitingList method, eg. when moving or deleting blocks. This currently causes an exception which kills the queue and prevents any further actions that are dependent on it.

It turned out that this was due to a missing dependency on a useSelect call, which was not easy to track down, so this PR just adds a hint at the point of failure to help if people encounter this in the future.

Types of changes

Just adds a comment to help people with debugging if they encounter a similar error

@glendaviesnz glendaviesnz added [Type] Bug An existing feature does not function as intended [Package] Priority Queue /packages/priority-queue labels Jan 20, 2021
@glendaviesnz glendaviesnz self-assigned this Jan 20, 2021
@github-actions
Copy link

github-actions bot commented Jan 20, 2021

Size Change: +79.7 kB (+6%) 🔍

Total Size: 1.37 MB

Filename Size Change
build/a11y/index.js 1.14 kB +2 B (0%)
build/annotations/index.js 3.77 kB -28 B (-1%)
build/api-fetch/index.js 3.4 kB -15 B (0%)
build/autop/index.js 2.84 kB -1 B (0%)
build/block-directory/index.js 9.1 kB +16 B (0%)
build/block-editor/index.js 124 kB +1.53 kB (+1%)
build/block-editor/style-rtl.css 12.1 kB +119 B (+1%)
build/block-editor/style.css 12.1 kB +123 B (+1%)
build/block-library/blocks/archives/editor-rtl.css 61 B -135 B (-69%) 🏆
build/block-library/blocks/archives/editor.css 60 B -136 B (-69%) 🏆
build/block-library/blocks/audio/editor-rtl.css 58 B -136 B (-70%) 🏆
build/block-library/blocks/audio/editor.css 58 B -136 B (-70%) 🏆
build/block-library/blocks/audio/style-rtl.css 103 B -122 B (-54%) 🏆
build/block-library/blocks/audio/style.css 103 B -122 B (-54%) 🏆
build/block-library/blocks/block/editor-rtl.css 161 B -122 B (-43%) 🎉
build/block-library/blocks/block/editor.css 161 B -122 B (-43%) 🎉
build/block-library/blocks/button/editor-rtl.css 475 B -101 B (-18%) 👏
build/block-library/blocks/button/editor.css 474 B -103 B (-18%) 👏
build/block-library/blocks/button/style-rtl.css 465 B -87 B (-16%) 👏
build/block-library/blocks/button/style.css 464 B -88 B (-16%) 👏
build/block-library/blocks/buttons/editor-rtl.css 233 B -112 B (-32%) 🎉
build/block-library/blocks/buttons/editor.css 233 B -113 B (-33%) 🎉
build/block-library/blocks/buttons/style-rtl.css 303 B -116 B (-28%) 🎉
build/block-library/blocks/buttons/style.css 303 B -116 B (-28%) 🎉
build/block-library/blocks/calendar/style-rtl.css 208 B -111 B (-35%) 🎉
build/block-library/blocks/calendar/style.css 208 B -111 B (-35%) 🎉
build/block-library/blocks/categories/editor-rtl.css 84 B -126 B (-60%) 🏆
build/block-library/blocks/categories/editor.css 83 B -126 B (-60%) 🏆
build/block-library/blocks/categories/style-rtl.css 79 B -129 B (-62%) 🏆
build/block-library/blocks/categories/style.css 79 B -129 B (-62%) 🏆
build/block-library/blocks/code/style-rtl.css 90 B -126 B (-58%) 🏆
build/block-library/blocks/code/style.css 90 B -126 B (-58%) 🏆
build/block-library/blocks/columns/editor-rtl.css 190 B -110 B (-37%) 🎉
build/block-library/blocks/columns/editor.css 190 B -109 B (-36%) 🎉
build/block-library/blocks/columns/style-rtl.css 421 B -108 B (-20%) 🎉
build/block-library/blocks/columns/style.css 421 B -107 B (-20%) 🎉
build/block-library/blocks/cover/editor-rtl.css 390 B -134 B (-26%) 🎉
build/block-library/blocks/cover/editor.css 389 B -133 B (-25%) 🎉
build/block-library/blocks/cover/style-rtl.css 1.25 kB -55 B (-4%)
build/block-library/blocks/cover/style.css 1.25 kB -54 B (-4%)
build/block-library/blocks/embed/editor-rtl.css 486 B -108 B (-18%) 👏
build/block-library/blocks/embed/editor.css 486 B -109 B (-18%) 👏
build/block-library/blocks/embed/style-rtl.css 396 B -93 B (-19%) 👏
build/block-library/blocks/embed/style.css 395 B -94 B (-19%) 👏
build/block-library/blocks/file/editor-rtl.css 199 B -115 B (-37%) 🎉
build/block-library/blocks/file/editor.css 198 B -115 B (-37%) 🎉
build/block-library/blocks/file/style-rtl.css 248 B -104 B (-30%) 🎉
build/block-library/blocks/file/style.css 248 B -104 B (-30%) 🎉
build/block-library/blocks/freeform/editor-rtl.css 2.45 kB -98 B (-4%)
build/block-library/blocks/freeform/editor.css 2.45 kB -99 B (-4%)
build/block-library/blocks/gallery/editor-rtl.css 679 B -104 B (-13%) 👏
build/block-library/blocks/gallery/editor.css 679 B -104 B (-13%) 👏
build/block-library/blocks/gallery/style-rtl.css 1.07 kB -106 B (-9%)
build/block-library/blocks/gallery/style.css 1.06 kB -106 B (-9%)
build/block-library/blocks/group/editor-rtl.css 318 B -115 B (-27%) 🎉
build/block-library/blocks/group/editor.css 317 B -115 B (-27%) 🎉
build/block-library/blocks/group/style-rtl.css 57 B -133 B (-70%) 🏆
build/block-library/blocks/group/style.css 57 B -133 B (-70%) 🏆
build/block-library/blocks/heading/editor-rtl.css 129 B -119 B (-48%) 🎉
build/block-library/blocks/heading/editor.css 129 B -119 B (-48%) 🎉
build/block-library/blocks/heading/style-rtl.css 76 B -136 B (-64%) 🏆
build/block-library/blocks/heading/style.css 76 B -136 B (-64%) 🏆
build/block-library/blocks/html/editor-rtl.css 281 B -103 B (-27%) 🎉
build/block-library/blocks/html/editor.css 281 B -104 B (-27%) 🎉
build/block-library/blocks/image/editor-rtl.css 717 B -84 B (-10%) 👏
build/block-library/blocks/image/editor.css 716 B -84 B (-10%) 👏
build/block-library/blocks/image/style-rtl.css 477 B -92 B (-16%) 👏
build/block-library/blocks/image/style.css 478 B -92 B (-16%) 👏
build/block-library/blocks/latest-comments/editor-rtl.css 159 B -118 B (-43%) 🎉
build/block-library/blocks/latest-comments/editor.css 158 B -117 B (-43%) 🎉
build/block-library/blocks/latest-comments/style-rtl.css 269 B -113 B (-30%) 🎉
build/block-library/blocks/latest-comments/style.css 269 B -113 B (-30%) 🎉
build/block-library/blocks/latest-posts/editor-rtl.css 137 B -117 B (-46%) 🎉
build/block-library/blocks/latest-posts/editor.css 137 B -117 B (-46%) 🎉
build/block-library/blocks/latest-posts/style-rtl.css 523 B -111 B (-18%) 👏
build/block-library/blocks/latest-posts/style.css 522 B -112 B (-18%) 👏
build/block-library/blocks/list/editor-rtl.css 65 B -138 B (-68%) 🏆
build/block-library/blocks/list/editor.css 65 B -138 B (-68%) 🏆
build/block-library/blocks/list/style-rtl.css 63 B -138 B (-69%) 🏆
build/block-library/blocks/list/style.css 63 B -138 B (-69%) 🏆
build/block-library/blocks/media-text/editor-rtl.css 191 B -120 B (-39%) 🎉
build/block-library/blocks/media-text/editor.css 191 B -120 B (-39%) 🎉
build/block-library/blocks/media-text/style-rtl.css 535 B -107 B (-17%) 👏
build/block-library/blocks/media-text/style.css 532 B -108 B (-17%) 👏
build/block-library/blocks/more/editor-rtl.css 434 B -111 B (-20%) 🎉
build/block-library/blocks/more/editor.css 434 B -111 B (-20%) 🎉
build/block-library/blocks/navigation-link/editor-rtl.css 395 B -108 B (-21%) 🎉
build/block-library/blocks/navigation-link/editor.css 397 B -107 B (-21%) 🎉
build/block-library/blocks/navigation-link/style-rtl.css 704 B -101 B (-13%) 👏
build/block-library/blocks/navigation-link/style.css 702 B -101 B (-13%) 👏
build/block-library/blocks/navigation/editor-rtl.css 1.33 kB -155 B (-10%) 👏
build/block-library/blocks/navigation/editor.css 1.33 kB -155 B (-10%) 👏
build/block-library/blocks/navigation/style-rtl.css 195 B -94 B (-33%) 🎉
build/block-library/blocks/navigation/style.css 195 B -94 B (-33%) 🎉
build/block-library/blocks/nextpage/editor-rtl.css 395 B -112 B (-22%) 🎉
build/block-library/blocks/nextpage/editor.css 395 B -112 B (-22%) 🎉
build/block-library/blocks/paragraph/editor-rtl.css 109 B -127 B (-54%) 🏆
build/block-library/blocks/paragraph/editor.css 109 B -127 B (-54%) 🏆
build/block-library/blocks/paragraph/style-rtl.css 273 B -119 B (-30%) 🎉
build/block-library/blocks/paragraph/style.css 273 B -119 B (-30%) 🎉
build/block-library/blocks/post-author/editor-rtl.css 209 B -120 B (-36%) 🎉
build/block-library/blocks/post-author/editor.css 209 B -120 B (-36%) 🎉
build/block-library/blocks/post-author/style-rtl.css 183 B -120 B (-40%) 🎉
build/block-library/blocks/post-author/style.css 184 B -119 B (-39%) 🎉
build/block-library/blocks/post-comments-form/style-rtl.css 250 B -108 B (-30%) 🎉
build/block-library/blocks/post-comments-form/style.css 250 B -108 B (-30%) 🎉
build/block-library/blocks/post-content/editor-rtl.css 139 B -123 B (-47%) 🎉
build/block-library/blocks/post-content/editor.css 139 B -123 B (-47%) 🎉
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B -133 B (-65%) 🏆
build/block-library/blocks/post-excerpt/editor.css 73 B -133 B (-65%) 🏆
build/block-library/blocks/post-featured-image/editor-rtl.css 338 B -115 B (-25%) 🎉
build/block-library/blocks/post-featured-image/editor.css 338 B -115 B (-25%) 🎉
build/block-library/blocks/post-featured-image/style-rtl.css 100 B -123 B (-55%) 🏆
build/block-library/blocks/post-featured-image/style.css 100 B -123 B (-55%) 🏆
build/block-library/blocks/preformatted/style-rtl.css 63 B -130 B (-67%) 🏆
build/block-library/blocks/preformatted/style.css 63 B -130 B (-67%) 🏆
build/block-library/blocks/pullquote/editor-rtl.css 183 B -121 B (-40%) 🎉
build/block-library/blocks/pullquote/editor.css 183 B -121 B (-40%) 🎉
build/block-library/blocks/pullquote/style-rtl.css 316 B -112 B (-26%) 🎉
build/block-library/blocks/pullquote/style.css 316 B -112 B (-26%) 🎉
build/block-library/blocks/query-loop/editor-rtl.css 90 B -127 B (-59%) 🏆
build/block-library/blocks/query-loop/editor.css 89 B -127 B (-59%) 🏆
build/block-library/blocks/query-loop/style-rtl.css 315 B -112 B (-26%) 🎉
build/block-library/blocks/query-loop/style.css 317 B -112 B (-26%) 🎉
build/block-library/blocks/query/editor-rtl.css 159 B -120 B (-43%) 🎉
build/block-library/blocks/query/editor.css 160 B -119 B (-43%) 🎉
build/block-library/blocks/quote/editor-rtl.css 61 B -134 B (-69%) 🏆
build/block-library/blocks/quote/editor.css 61 B -134 B (-69%) 🏆
build/block-library/blocks/quote/style-rtl.css 169 B -115 B (-40%) 🎉
build/block-library/blocks/quote/style.css 169 B -116 B (-41%) 🎉
build/block-library/blocks/rss/editor-rtl.css 201 B -106 B (-35%) 🎉
build/block-library/blocks/rss/editor.css 202 B -107 B (-35%) 🎉
build/block-library/blocks/rss/style-rtl.css 290 B -104 B (-26%) 🎉
build/block-library/blocks/rss/style.css 290 B -103 B (-26%) 🎉
build/block-library/blocks/search/editor-rtl.css 165 B -120 B (-42%) 🎉
build/block-library/blocks/search/editor.css 165 B -120 B (-42%) 🎉
build/block-library/blocks/search/style-rtl.css 342 B -112 B (-25%) 🎉
build/block-library/blocks/search/style.css 344 B -112 B (-25%) 🎉
build/block-library/blocks/separator/editor-rtl.css 99 B -130 B (-57%) 🏆
build/block-library/blocks/separator/editor.css 99 B -130 B (-57%) 🏆
build/block-library/blocks/separator/style-rtl.css 236 B -116 B (-33%) 🎉
build/block-library/blocks/separator/style.css 236 B -116 B (-33%) 🎉
build/block-library/blocks/shortcode/editor-rtl.css 504 B -99 B (-16%) 👏
build/block-library/blocks/shortcode/editor.css 504 B -99 B (-16%) 👏
build/block-library/blocks/site-logo/editor-rtl.css 201 B -120 B (-37%) 🎉
build/block-library/blocks/site-logo/editor.css 201 B -120 B (-37%) 🎉
build/block-library/blocks/site-logo/style-rtl.css 117 B -121 B (-51%) 🏆
build/block-library/blocks/site-logo/style.css 117 B -121 B (-51%) 🏆
build/block-library/blocks/social-link/editor-rtl.css 164 B -119 B (-42%) 🎉
build/block-library/blocks/social-link/editor.css 165 B -118 B (-42%) 🎉
build/block-library/blocks/social-links/editor-rtl.css 696 B -115 B (-14%) 👏
build/block-library/blocks/social-links/editor.css 696 B -114 B (-14%) 👏
build/block-library/blocks/social-links/style-rtl.css 1.37 kB -109 B (-7%)
build/block-library/blocks/social-links/style.css 1.37 kB -109 B (-7%)
build/block-library/blocks/spacer/editor-rtl.css 302 B -114 B (-27%) 🎉
build/block-library/blocks/spacer/editor.css 302 B -114 B (-27%) 🎉
build/block-library/blocks/spacer/style-rtl.css 48 B -136 B (-74%) 🏆
build/block-library/blocks/spacer/style.css 48 B -136 B (-74%) 🏆
build/block-library/blocks/subhead/editor-rtl.css 99 B -124 B (-56%) 🏆
build/block-library/blocks/subhead/editor.css 99 B -124 B (-56%) 🏆
build/block-library/blocks/subhead/style-rtl.css 80 B -130 B (-62%) 🏆
build/block-library/blocks/subhead/style.css 80 B -130 B (-62%) 🏆
build/block-library/blocks/table/editor-rtl.css 489 B -104 B (-18%) 👏
build/block-library/blocks/table/editor.css 489 B -104 B (-18%) 👏
build/block-library/blocks/table/style-rtl.css 386 B -115 B (-23%) 🎉
build/block-library/blocks/table/style.css 386 B -115 B (-23%) 🎉
build/block-library/blocks/tag-cloud/editor-rtl.css 118 B -119 B (-50%) 🏆
build/block-library/blocks/tag-cloud/editor.css 118 B -117 B (-50%) 🏆
build/block-library/blocks/tag-cloud/style-rtl.css 94 B -127 B (-57%) 🏆
build/block-library/blocks/tag-cloud/style.css 94 B -127 B (-57%) 🏆
build/block-library/blocks/template-part/editor-rtl.css 557 B -237 B (-30%) 🎉
build/block-library/blocks/template-part/editor.css 556 B -238 B (-30%) 🎉
build/block-library/blocks/text-columns/editor-rtl.css 95 B -125 B (-57%) 🏆
build/block-library/blocks/text-columns/editor.css 95 B -125 B (-57%) 🏆
build/block-library/blocks/text-columns/style-rtl.css 166 B -117 B (-41%) 🎉
build/block-library/blocks/text-columns/style.css 166 B -117 B (-41%) 🎉
build/block-library/blocks/verse/editor-rtl.css 62 B -132 B (-68%) 🏆
build/block-library/blocks/verse/editor.css 62 B -132 B (-68%) 🏆
build/block-library/blocks/verse/style-rtl.css 87 B -128 B (-60%) 🏆
build/block-library/blocks/verse/style.css 87 B -128 B (-60%) 🏆
build/block-library/blocks/video/editor-rtl.css 504 B -113 B (-18%) 👏
build/block-library/blocks/video/editor.css 503 B -114 B (-18%) 👏
build/block-library/blocks/video/style-rtl.css 193 B -110 B (-36%) 🎉
build/block-library/blocks/video/style.css 193 B -111 B (-37%) 🎉
build/block-library/editor-rtl.css 9.04 kB -25 B (0%)
build/block-library/editor.css 9.02 kB -36 B (0%)
build/block-library/index.js 144 kB +2.3 kB (+2%)
build/block-library/style-rtl.css 8.8 kB +211 B (+2%)
build/block-library/style.css 8.8 kB +213 B (+2%)
build/block-library/theme-rtl.css 748 B -112 B (-13%) 👏
build/block-library/theme.css 748 B -112 B (-13%) 👏
build/block-serialization-default-parser/index.js 1.88 kB -5 B (0%)
build/blocks/index.js 48.2 kB +95 B (0%)
build/components/index.js 270 kB +96.6 kB (+56%) 🆘
build/components/style-rtl.css 15.5 kB +63 B (0%)
build/components/style.css 15.5 kB +64 B (0%)
build/compose/index.js 11 kB -254 B (-2%)
build/core-data/index.js 16.8 kB +1.57 kB (+10%) ⚠️
build/data-controls/index.js 827 B -2 B (0%)
build/data/index.js 8.86 kB -131 B (-1%)
build/dom-ready/index.js 570 B -1 B (0%)
build/dom/index.js 4.93 kB -16 B (0%)
build/edit-navigation/index.js 10.5 kB -650 B (-6%)
build/edit-navigation/style-rtl.css 1.11 kB +173 B (+18%) ⚠️
build/edit-navigation/style.css 1.11 kB +164 B (+17%) ⚠️
build/edit-post/index.js 307 kB +551 B (0%)
build/edit-post/style-rtl.css 6.79 kB +282 B (+4%)
build/edit-post/style.css 6.78 kB +282 B (+4%)
build/edit-site/index.js 24.8 kB +611 B (+3%)
build/edit-site/style-rtl.css 4.04 kB +29 B (+1%)
build/edit-site/style.css 4.04 kB +28 B (+1%)
build/edit-widgets/index.js 20 kB -3.57 kB (-15%) 👏
build/edit-widgets/style-rtl.css 3.2 kB +34 B (+1%)
build/edit-widgets/style.css 3.2 kB +33 B (+1%)
build/editor/index.js 41.8 kB -72 B (0%)
build/element/index.js 4.61 kB -10 B (0%)
build/format-library/index.js 6.76 kB +2 B (0%)
build/format-library/style-rtl.css 637 B +17 B (+3%)
build/format-library/style.css 639 B +18 B (+3%)
build/hooks/index.js 2.28 kB +7 B (0%)
build/html-entities/index.js 622 B -1 B (0%)
build/i18n/index.js 4.01 kB +443 B (+12%) ⚠️
build/is-shallow-equal/index.js 699 B +2 B (0%)
build/keyboard-shortcuts/index.js 2.53 kB -7 B (0%)
build/keycodes/index.js 1.93 kB -9 B (0%)
build/list-reusable-blocks/index.js 3.15 kB +1 B (0%)
build/media-utils/index.js 5.35 kB +37 B (+1%)
build/notices/index.js 1.85 kB -5 B (0%)
build/nux/index.js 3.41 kB -14 B (0%)
build/plugins/index.js 2.54 kB +2 B (0%)
build/primitives/index.js 1.42 kB -13 B (-1%)
build/priority-queue/index.js 791 B +1 B (0%)
build/reusable-blocks/index.js 2.92 kB -7 B (0%)
build/rich-text/index.js 13.4 kB -94 B (-1%)
build/server-side-render/index.js 2.77 kB -1 B (0%)
build/shortcode/index.js 1.7 kB -1 B (0%)
build/token-list/index.js 1.27 kB +2 B (0%)
build/url/index.js 3.01 kB -4 B (0%)
build/warning/index.js 1.14 kB +1 B (0%)
build/wordcount/index.js 1.22 kB -1 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/blob/index.js 665 B 0 B
build/block-directory/style-rtl.css 1.01 kB 0 B
build/block-directory/style.css 1.01 kB 0 B
build/block-library/blocks/page-list/editor-rtl.css 214 B 0 B
build/block-library/blocks/page-list/editor.css 214 B 0 B
build/block-library/blocks/page-list/style-rtl.css 527 B 0 B
build/block-library/blocks/page-list/style.css 526 B 0 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B 0 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B 0 B
build/block-library/blocks/query-pagination/editor-rtl.css 270 B 0 B
build/block-library/blocks/query-pagination/editor.css 262 B 0 B
build/block-library/blocks/query-pagination/style-rtl.css 168 B 0 B
build/block-library/blocks/query-pagination/style.css 168 B 0 B
build/block-library/common-rtl.css 1.01 kB 0 B
build/block-library/common.css 1.01 kB 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/customize-widgets/index.js 4.08 kB 0 B
build/customize-widgets/style-rtl.css 168 B 0 B
build/customize-widgets/style.css 168 B 0 B
build/date/index.js 31.8 kB 0 B
build/deprecated/index.js 769 B 0 B
build/editor/editor-styles-rtl.css 543 B 0 B
build/editor/editor-styles.css 545 B 0 B
build/editor/style-rtl.css 3.89 kB 0 B
build/editor/style.css 3.89 kB 0 B
build/escape-html/index.js 735 B 0 B
build/list-reusable-blocks/style-rtl.css 629 B 0 B
build/list-reusable-blocks/style.css 628 B 0 B
build/nux/style-rtl.css 731 B 0 B
build/nux/style.css 727 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/viewport/index.js 1.86 kB 0 B

compressed-size-action

@@ -96,7 +96,11 @@ export const createQueue = () => {
const callback = /** @type {WPPriorityQueueCallback} */ ( elementsMap.get(
nextElement
) );
callback();

if ( typeof callback === 'function' ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

another option would be a try/catch here instead, with a warning for isDev on catch so at least there is an indication that something is going through the queue without a callback

Copy link
Contributor

Choose a reason for hiding this comment

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

in which case the callback won't be a valid function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@youknowriad It turns out that in some cases if the callBack in runWaitingList takes a while to complete, the element can be added back to the waitList before elementsMap.delete is called. It then gets called before the new element in the waitingList goes through runWaitingList, so when it does there is no matching element in the elementsMap and the exception happens.

Screen Shot 2021-02-10 at 2 53 34 PM

I added some extra debugging in this PR, and you can see above callback being called for waitingList item 82, but then item 83 being added before the delete from element map happens for 82.

I have changed this PR to handle this situation by check that an element has not been added back to the waitList before deleting it from the element map, and this seems to fix the issue in the gallery refactor PR, but not sure if there are any other implications to handling this way.

@glendaviesnz
Copy link
Contributor Author

glendaviesnz commented Jan 20, 2021

@talldan, @ellatrix do you have any thoughts on why this queue might be getting an undefined callback in the gallery refactor, and if adding this defensive check is a good approach or not? Seems like even if we track down what is causing the undefined callback that it would be a good idea to prevent the queue dying in these instances.

@talldan
Copy link
Contributor

talldan commented Jan 22, 2021

@glendaviesnz I don't know much about the priority queue package. Looking at the history, @youknowriad has authored some commits.

@youknowriad
Copy link
Contributor

I feel we should try to find the original issue and not hide it. The main usage of this package is for the async mode. The idea of the async mode is that useSelect callbacks are not batched for unselected blocks.

@glendaviesnz
Copy link
Contributor Author

I feel we should try to find the original issue and not hide it.

@youknowriad I agree that it would be good to track down the reason why it ends up as undefined ... but I wasn't able to successfully debug it as I don't have a good enough understanding of how this queue is working. If you check out the Gallery Refactor PR add a gallery with some images, and then move a image within the gallery the error will be thrown ... any help you can provide in debugging this would be greatly appreciated as it is one of the last remaining bugs to sort on this refactor.

Glen Davies added 2 commits February 9, 2021 16:32
…n't been added back to the waitlist before deleting from the element map.
@glendaviesnz glendaviesnz changed the title Check that waitingList callbacks are defined before calling to prevent queue failures Add note to indicate why priority queue callbacks my be undefined Feb 10, 2021
@glendaviesnz glendaviesnz changed the title Add note to indicate why priority queue callbacks my be undefined Add note to indicate why priority queue callbacks may be undefined Feb 10, 2021
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

@glendaviesnz glendaviesnz merged commit 4cec557 into master Feb 10, 2021
@glendaviesnz glendaviesnz deleted the fix/priority-queue-undefined-callback branch February 10, 2021 21:14
@github-actions github-actions bot added this to the Gutenberg 10.1 milestone Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Priority Queue /packages/priority-queue [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants