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.

Duplicate discussions created when data-strict is enabled

See original GitHub issue

Hi, I recently switched my blog to using giscus, so thank you so much for creating a great tool!

Unfortunately I’ve just noticed that giscus appears to be creating duplicate discussions for a post, even though I have data-strict set. I’ve also restricted to a single origin, so I know it’s not a duplicate somewhere creating them either…

My configuration looks like this:

<script src="https://giscus.app/client.js"
        data-repo="andrewlock/blog-comments"
        data-repo-id="R_kgDOHvS21g"
        data-category="Announcements"
        data-category-id="DIC_kwDOHvS21s4CQg24"
        data-mapping="pathname"
        data-strict="1"
        data-reactions-enabled="1"
        data-emit-metadata="0"
        data-input-position="top"
        data-theme="preferred_color_scheme"
        data-lang="en"
        data-loading="lazy"
        crossorigin="anonymous"
        async>
</script>

This is an example post that has a problem: https://andrewlock.net/adding-validation-to-strongly-typed-configuration-objects-in-dotnet-6/

And these are the two discussions it created:

I don’t suppose you have any idea what’s going on? thanks very much for your help!

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
laymonagecommented, Nov 6, 2022

Indeed it is, but it doesn’t seem to be what happened in your case. Both discussions were created at the same minute, but this comment is the only one with the same timestamp as the discussion creation: https://github.com/andrewlock/blog-comments/discussions/48#discussioncomment-3795551

The first comment on the other discussion is a few minutes later: https://github.com/andrewlock/blog-comments/discussions/47#discussioncomment-3833670

There are a couple of reactions though, so might be from there as well, but what are the chances of the reactions being submitted as the first comment on the other discussion?..

I also found another instance of this happening, though there are no comments:

I assume that was you, pregenerating the discussion by commenting then deleting the comment? Not sure how you did that. though.

I’m pretty sure this is reproducible by opening two tabs, leaving an initial comment on one tab, and another comment on the other tab after the first one has been submitted.

Maybe I should make it so that giscus’ creation API searches for a matching discussion before actually sending a create mutation to GitHub…

0reactions
yihuicommented, Dec 16, 2022

Maybe I should make it so that giscus’ creation API searches for a matching discussion before actually sending a create mutation to GitHub…

I also think that’s definitely a great idea—the decision on whether to create a new discussion should be made right before actually creating it, instead of at the moment when giscus is loaded on the page. For a popular site, the latter can easily lead to duplicate discussions (many people reading the page at the same time but they could finish typing out the comments at any time).

Thanks for the great work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Replacing Disqus with GitHub discussions using giscus
I decided to create a completely new repository, on the basis that my current blog repository is not public (for Reasons™), and that...
Read more >
How do I duplicate a discussion in a course?
You can duplicate a discussion in your course. When a discussion is duplicated, the word Copy is added to the end of the...
Read more >
Use GitHub as commenting system for Hugo - KD's Blog
Discussion Category : General or create a custom category and select preferred one. Select Theme and features. Copy the Enable giscus script ...
Read more >
How do I duplicate a discussion in a course? | Instructor Guides
You can duplicate a discussion in your course. When a discussion is duplicated, the word Copy is added to the end of the...
Read more >
Will discussion posts carry over when I duplicate a course?
When a course with on-lesson discussions enabled is duplicated, ... multiple different courses to interact with each other, you could create a Community!...
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