Skip to content

Learn WordPress Content Error Report - Ticket #1096

@chthonic-ds

Description

@chthonic-ds

Error Description

Just noting a small issue in Step 3 of the Editing WordPress data records section of the Using the WordPress Data Layer course.

The code block in question (directly follows the sentence, "Let's update EditPageForm accordingly:"):

export function EditPageForm( { pageId, onCancel, onSaveFinished } ) {
    const page = useSelect(
        select => select( coreDataStore ).getEntityRecord( 'postType', 'page', pageId ),
        [pageId]
    );
    return (
        <div className="my-gutenberg-form">
            <TextControl
                label='Page title:'
                value={ page.title }
            />
            { /* ... */ }
        </div>
    );
}

At this point in the lesson value={ page.title } returns [object Object] for the TextControl's value attribute. However, the expectation set by the accompanying screenshot is the label will display correctly as a string.

When Step 4 has been completed value={ page.title } renders the label as expected (as explained by the sentence, "the title of an Entity Record is an object, but the title of an Edited Entity record is a string").

Removing that Step 3 screenshot would help clear up potential/my confusion here?

Error Report Checklist:

  • Error Validated
  • Error fix proposed
  • Error fix reviewed
  • Error fix published

Metadata

Metadata

Assignees

Labels

[Content] FeedbackFeedback provided about content on Learn.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions