question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

url and identifier not making a difference, all comment boxes are the same

See original GitHub issue

On my page, I render a list of posts with a “SHOW COMMENTS” button that reveals the DiscussionEmbed element:

  const postObjects = posts.map((p,index)=>{
    return (
        <div className="Post">

                <ReactMarkdown children={p.md}/>

                <button
                    onClick={()=>{
                        showComments(p.filename);
                    }}
                >
                    SHOW COMMENTS
                </button>

                { currentPost == p.filename &&  
                    <DiscussionEmbed
                        shortname={MY_DISQUS_SHORTNAME}
                        config={
                            {
                                url: `${MY_URL}#!${p.filename}`,
                                identifier: p.filename,
                                title: p.filename,
                            }
                        }
                    />                
                }

        </div>
    )
  });

here is the showComments function, which fires when the button is pressed, reset DISQUS from its window object and sets currentPost which then shows the DiscussionEmbed component that matches:

  const showComments = (filename) => {
      if (window.DISQUS) window.DISQUS.reset({
        reload: true,
        config: function () {  
          console.log(this);
          this.page.identifier = filename;  
          this.page.url = `${MY_URL}#!${p.filename}`;
        }
      });           
      setCurrentPost(filename);
  }

Anyway, all the comment blocks are the same / have the same comments. If I click the links to the comments contained in they have:

MY_URL

instead of

`MY_URL#!filename

What am I doing wrong?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kyagercommented, Feb 20, 2021

I had the same problem using the DiscussionEmbed example. The fix mentioned earlier didn’t work, but I was able to get it working by using setState and useEffect, and a loading prop.

const [disqusConfig, setDisqusConfig] = useState({});setDisqusConfig({ url: "https://mywebsite.com/" + post.slug, identifier: post.id, title: post.title });<DiscussionEmbed shortname="my-web-site" config={disqusConfig} />

1reaction
MaxPRaffertycommented, Jan 31, 2021

Clue: test_post_0 works, but test-post_0 does not. It appears these strings are character restricted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disqus showing same comments on all pages with unique ...
I viewed disqus admin page and it showed http://127.0.0.1:8000/post as the thread url, editing it gave me an error about invalid url format....
Read more >
Why are the same comments showing up on multiple pages?
This is known as identifier conflict because, even though each page will have a unique Disqus identifier, the pages share the same thread...
Read more >
Unable to set Identifier (Entity ID) or Reply URL for Azure ...
I have the same problem as @CarolineLu-1373 : "When I try to set the Identifier (Entity ID) or Reply URL for a new...
Read more >
NetLogo 6.3.0 User Manual: Programming Guide
This section describes the NetLogo programming language in detail. The Code Example models mentioned throughout can be found in the Code Examples section...
Read more >
Failed to register bundle identifi… | Apple Developer Forums
Im getting the error "Failed to register bundle identifier. ... Add a Comment ... I was working fine this morning and got the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found