Skip to content

Commit

Permalink
[Block Library - Query Pagination]: Fix update when unmounted (#34756)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras authored Sep 13, 2021
1 parent b686c45 commit 217ff42
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ function ToggleGroupControlBackdrop( {
setLeft( offsetLeft );
setWidth( offsetWidth );

let requestId: number;
if ( ! canAnimate ) {
window.requestAnimationFrame( () => {
requestId = window.requestAnimationFrame( () => {
setCanAnimate( true );
} );
}
return () => window.cancelAnimationFrame( requestId );
}, [ canAnimate, containerRef, containerWidth, state, isAdaptiveWidth ] );

return (
Expand Down

0 comments on commit 217ff42

Please sign in to comment.