Skip to content

Commit

Permalink
Explain why we disable the react-hooks/exhaustive-deps lint
Browse files Browse the repository at this point in the history
  • Loading branch information
michalczaplinski committed Nov 29, 2024
1 parent ff1d50b commit 33fd080
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/block-library/src/search/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ export default function SearchEdit( {
const { name, ...metadata } = attributes.metadata || {};
setAttributes( { metadata } );
}

// We disable the exhaustive-deps warning because the effect should not depend
// on the attributes.metadata value. We only want to re-run the effect when the
// isEnhancedPagination value changes.

// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ isEnhancedPagination, setAttributes ] );

const wasJustInsertedIntoNavigationBlock = useSelect(
Expand Down

0 comments on commit 33fd080

Please sign in to comment.