Skip to content

Commit

Permalink
Block API: Deprecate id prop in favor of clientId
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jul 2, 2018
1 parent 354756a commit cb3ac29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/reference/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo
- `blocks.BlockEdit` filter removed. Please use `editor.BlockEdit` instead.
- `blocks.BlockListBlock` filter removed. Please use `editor.BlockListBlock` instead.
- `blocks.MediaUpload` filter removed. Please use `editor.MediaUpload` instead.
- Block `id` prop in `edit` function removed. Please use block `clientId` prop instead.

## 3.2.0

Expand Down
14 changes: 13 additions & 1 deletion editor/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { withFilters } from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { withDispatch, withSelect } from '@wordpress/data';
import { withViewportMatch } from '@wordpress/viewport';
import deprecated from '@wordpress/deprecated';

/**
* Internal dependencies
Expand Down Expand Up @@ -533,7 +534,18 @@ export class BlockListBlock extends Component {
insertBlocksAfter={ isLocked ? undefined : this.insertBlocksAfter }
onReplace={ isLocked ? undefined : onReplace }
mergeBlocks={ isLocked ? undefined : this.mergeBlocks }
id={ uid }
clientId={ uid }
{ ...{
get id() {
deprecated( 'block `id` prop in `edit` function', {
version: '3.3',
alternative: 'block `clientId` prop',
plugin: 'Gutenberg',
} );

return uid;
},
} }
isSelectionEnabled={ this.props.isSelectionEnabled }
toggleSelection={ this.props.toggleSelection }
/>
Expand Down

0 comments on commit cb3ac29

Please sign in to comment.