Cannot read property 'forumsFollowing' of undefined
See original GitHub issueDescribe the bug
I’m not sure what the root cause of this bug is, but sometimes (often) when I try clicking the button on the Disqus component that opens the Disqus overlay, I get the error Cannot read property 'forumsFollowing' of undefined
in my console. At this point nothing happens, but I cannot interact with my page any longer due to the error.
To Reproduce
It’s happening just when the component loads, and I click the button next to the comment count that opens the overlay for my forum.
EDIT On closer investigation, this bug appears to occur as a result of a button I have to load the discussion thread. If the component loads on start, it works fine, but if I have a conditional rendering that causes the discussion thread to only load when I click a button, then loading the overlay creates this bug. The conditional render looks like this:
if(this.state.displayComments && this.state.disqusConfig) {
const disqusConfig = this.state.disqusConfig;
return <DiscussionEmbed shortname={disqusConfig.disqusShortName} config={disqusConfig.config} />;
}
return (
<div className={styles.commentsButton}>
<Button onClick={() => {this.setState({displayComments: true})}}>Load Comments</Button>
</div>
)
EDIT 2 The issue doesn’t seem to be exclusive to the above scenario after all.
Expected behavior
The forum overlay opens without any errors.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
@DanielW093 We appreciate you bringing this issue to our attention, a fix has been merged and will be deployed shortly.
@DanielW093 I was able to recreate the issue both with and without having the component behind a button, so I’ll continue looking into this further and try to track down the cause.
Update: It appears that the scope of this issue goes beyond this package and is occurring on many websites that feature Disqus comments. We’re currently working on tracking down the cause but I’ll leave this issue open until we deploy a fix.