Skip to content

Commit

Permalink
set postId when slug is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Addison-Stavlo committed Aug 11, 2020
1 parent 27b5d91 commit 61fa1bf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions packages/block-library/src/template-part/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ export default function TemplatePartEdit( {

// Resolve the post ID if not set, and load its post.
const postId = useTemplatePartPost( _postId, slug, theme );
useEffect( () => {
setAttributes( { postId } );
}, [ postId ] );

// Set the post ID, once found, so that edits persist,
// but wait until the third inner blocks change,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function TemplatePartNamePanel( { postId, setAttributes } ) {
setTitle( value );
const newSlug = cleanForSlug( value );
setSlug( newSlug );
setAttributes( { slug: newSlug } );
setAttributes( { slug: newSlug, postId } );
} }
onFocus={ ( event ) => event.target.select() }
/>
Expand Down

0 comments on commit 61fa1bf

Please sign in to comment.