• Resolved H. Adam Lenz

    (@adrock42)


    I don’t think checking to see if the editor is dirty is a good way to kickoff dispatching an edit entity record. I’m assuming some blocks change the editing state just enough to make it dirty so the dispatch can go through there. And when it does I see

    This block has encountered an error and cannot be previewed.

    react-dom.min.js?ver=18:1 
    TypeError: Cannot read properties of undefined (reading 'meta')
    at actions.js:387:25 at Array.reduce (<anonymous>)
    at actions.js:386:32 at thunk-middleware.js:4:11
    at index.js:24:12 at promise-middleware.js:20:9
    at Object.dispatch (resolvers-cache-middleware.js:45:10)
    at Object.editEntityRecord (index.js:208:29)
    at main.min.js?ver=6.9.0:5303:24
    at emitter.ts:22:52ur

    so where ever you are getting that meta from cannot be read from because it’s undefined

    I was able to get the error to go away if I was passing a blank {}, but I’m sure it would be better to check that there is something useful coming from the reduce above it

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter H. Adam Lenz

    (@adrock42)

    here is an example of where setAttributes might be called and make the editor dirty

    Plugin Support Darian

    (@d0153)

    Hi @adrock42

    Thank you for reaching out and providing the details about the issue.

    Let me share this with the team for their review, and I will keep you updated as soon as I have more information.

    Plugin Support Darian

    (@d0153)

    Hi @adrock42

    I’m glad you brought this to our attention, our team is already checking on this issue, and we’ve already created an internal ticket [TECTRIA-645] to address. I’ve also included your specific use case in it to communicate it to our team.

    We prioritize bugs by taking into consideration the number of users impacted as well as how the bug impacts one’s ability to run an event/sell tickets. I don’t have a specific timeline as to when this issue will be resolved, but trust that our team is aware. Our team communicates updates and bug fixes in our newsletter and via our changelog.

    In the meantime, it would be greatly helpful if you could provide detailed steps on how we can replicate the issue. This will allow us to investigate further and identify the root cause more effectively.

    Looking forward to your reply.

    Internal Bug Ticket Reference: TECTRIA-645

    Thread Starter H. Adam Lenz

    (@adrock42)

    a very simple example would be something like

    registerBlockType( 'my/block-name', {
    edit: ( props ) => {
    const { attributes: {myClientId}, clientId, setAttributes } = props;

    useEffect(()=>{
    setAttributes({myClientId:clientId})
    }, [clientId])
    }
    })

    this would make the editor immediately dirty when the block loads which is not great, but some blocks might have to use that as the clientId is changed on every load of the editor. None the less, TEC will be the good code test for other block devs in it’s current state. I suggested something like this in the subscriber so that this code is not run against posts that are not events.

    const postType = wpSelect( 'core/editor' ).getPostTypeLabel();
    if( postType!==editor.EVENT ) return;

    This only happens when editing a page on /wp-admin/site-editor.php and not /wp-admin/post.php

    I also see the same error when adding a paragraph to a page in the site-editor, saving the page, then reloading. After the reload, when I delete the paragraph I get the same error:
    Cannot read properties of undefined (reading 'meta')

    I observed the error in a new local site with the 2024 theme enabled and no other plugins enabled. In short, the subscriber mentioned in the first comment is too greedy when editing a page with the site-editor

    Plugin Support Darian

    (@d0153)

    Hi @adrock42

    Thank you for your response.

    I’ll make sure to share this with the team for further review.

    If you have any other questions or concerns, please feel free to start a new thread. This helps us track topics and issues more effectively while adhering to the WordPress Forum Guidelines.

    We appreciate your understanding and look forward to assisting you further.

    Plugin Support Darian

    (@d0153)

    Hi @adrock42

    It seems there hasn’t been any recent activity on this thread, so we’ll close this for now. Rest assured, we’ll provide an update here as soon as the fix is released.

    Thank you for your patience and understanding.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘the editor is dirty before meta is available’ is closed to new replies.