Skip to content

Commit

Permalink
Editor: Refactor title saving logic to simplify debouncing mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshbhutkar committed Dec 31, 2024
1 parent 11fc66d commit 7277a18
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/block-library/src/post-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,12 @@ export default function PostTitleEdit( {
);

const { saveEntityRecord } = useDispatch( coreStore );
const debouncedSaveTitle = useDebounce( ( newTitle ) => {
const setTitle = useDebounce( ( newTitle ) => {
saveEntityRecord( 'postType', 'post', {
id: postId,
title: newTitle,
} );
}, 500 );
const setTitle = ( newTitle ) => {
debouncedSaveTitle( newTitle );
};
const [ link ] = useEntityProp( 'postType', postType, 'link', postId );
const onSplitAtEnd = () => {
insertBlocksAfter( createBlock( getDefaultBlockName() ) );
Expand Down

0 comments on commit 7277a18

Please sign in to comment.