Error message when trying to create a post or page

I’m getting an error message when I try to create a new post or page…

TypeError: Cannot read property ‘split’ of undefined
at DiscourseSidebar.buildPostState (https://fpadvance.com/wp-content/plugins/wp-discourse/admin/discourse-sidebar/build/index.js?ver=1606956042:1211:41)
at DiscourseSidebar.initializePostState (https://fpadvance.com/wp-content/plugins/wp-discourse/admin/discourse-sidebar/build/index.js?ver=1606956042:1192:43)
at new DiscourseSidebar (https://fpadvance.com/wp-content/plugins/wp-discourse/admin/discourse-sidebar/build/index.js?ver=1606956042:1124:29)
at Ag (https://fpadvance.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:63:107)
at Vg (https://fpadvance.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:89:442)
at ph (https://fpadvance.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:217:70)
at lh (https://fpadvance.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:126:409)
at O (https://fpadvance.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:121:71)
at ze (https://fpadvance.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:118:14)
at https://fpadvance.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:53:49
1 Like

Thanks, this one will be resolved when this is merged

https://github.com/discourse/wp-discourse/pull/381

cc @simon

5 Likes

Thanks Angus! Your changes have been merged into WP Discourse 2.2.0. That version of the plugin is available in the WordPress plugin repo now.

3 Likes

Thank you so much! Confirmed this has resolved the issue.

3 Likes

Issue with this error is happening again. Getting the same error when trying to edit posts/pages.

Hey Phillip, I can’t reproduce this one. Can you confirm

  1. The exception message (the text in the console)
  2. Which version of the plugin you’re using
  3. Which version of wordpress you’re using
  4. Which editor you’re using (Gutenberg or Classic)

Thanks mate.

  • Here is the exception message…
    TypeError: Cannot read property ‘split’ of undefined
    at DiscourseSidebar.buildPostState (index.js:694)
    at DiscourseSidebar.initializePostState (index.js:675)
    at new DiscourseSidebar (index.js:606)
    at Ag (react-dom.min.js?ver=16.9.0:63)
    at Vg (react-dom.min.js?ver=16.9.0:89)
    at ph (react-dom.min.js?ver=16.9.0:217)
    at lh (react-dom.min.js?ver=16.9.0:126)
    at O (react-dom.min.js?ver=16.9.0:121)
    at ze (react-dom.min.js?ver=16.9.0:118)
    at react-dom.min.js?ver=16.9.0:53
  • Plugin version is 2.2.0
  • WP version 5.5.3
  • Error occurs in both Classic and Gutenberg editors.
1 Like

Could you also share the value of the setting “Post Types to Publish” in “Publishing”? (take a screenshot of the setting if possible).

I’ll push a fix for this shortly so you can use the plugin again, but the reason I need to know a bit more (and the reason this is not appearing elsewhere) is that the immediate issue is indicative of another issue, and the immeidate band aid will obscure that other issue.

1 Like

@alchemyandaim There’s a PR open to fix the immediate issue: https://github.com/discourse/wp-discourse/pull/386. In addition to sharing the “Post Types to Publish” setting could you clarify something for me?

It’s not possible to get the exception you’ve quoted in the classic editor (the relevant code isn’t loaded in the classic editor at all). Are you sure you’re seeing an error in the classic editor? If so could you share that error?

The classic editor is the one that looks like this

Here is the screen shot you requested.

Also I did just verify that the problem occurs in only Gutenberg editor. Classic is okay.

1 Like

Thanks. And you’re only seeing the exception occur when attempting to edit normal wordpress posts? Does it occur when you’re attempting to

  • create posts?
  • create pages?
  • edit pages?
  • when you’re creating or editing anything else?

Thanks for your help on this. I’d like to get to the bottom of it, as opposed to just applying the band aid (which we will also do shortly) as that’ll make for greater stability over the long term.

1 Like

Error occurs when creating or editing pages only. Posts are fine.

1 Like

Thanks Angus! The PR has been merged into the master branch and pushed to the WordPress plugin repo.

@alchemyandaim, updating to WP Discourse 2.2.1 from your WordPress dashboard should fix the issue for you.

@simon @angus
Confirmed this fixed the issue! thanks guys and happy holidays!

1 Like