Comments (19)
@mosamlife Unfortunately, it isn't possible to have two Disqus thread instances loaded on a page simultaneously, but you should be able to achieve similar functionality with the current component.
Depending on how your page is configured, you could update the disqus_config
that is being passed to the component to match the post that is currently in the viewport.
Without an example repo I'm not really able to be too specific about the implementation, though I'd be happy to help if you are able to provide one.
from disqus-react.
Hi All,
I am having similar issue. Here are more details:
- We have a application developed using Gatsby + React. I am trying to add comment functionality to this application using disqus
- Installed disqus-react npm package
- And added below code to two .js files with different uri, identifier and title.
import { DiscussionEmbed } from "disqus-react"
-----
-----
export default () => {
------
-----
return (
------
------
<DiscussionEmbed
shortname="xxxxxxx"
config={{
url: `xxxxxxx`,
identifier: "xxxxxxxx",
title: "xxxxxxxxx",
}}
/>
)
}
- Disqus comment section is successfully loaded in both pages and I am able to add comments
- But comments that I added in both pages are combined and displayed in both pages. I mean page1 comments are showing on page2 and page2 comments are showing on page1.
- I am expecting each page should display comments that are added in that page only.
Is this possible ? or am I doing anything wrong.
Please let me know if you need more details
from disqus-react.
@janakiramg If you could provide a link to a repo that I could use to troubleshoot the issue I could be more helpful, but it sounds like you might not be providing each thread with a unique identifier
.
You can find more info about this in the Knowledge Base.
from disqus-react.
Can I share .zip file with you ? I can email .zip to you.
from disqus-react.
Thanks for sharing information. We are using private github repo and I don't have permission to add you to github repository.
I have two simple .js files and I am using different identifier, Url for both these pages. I have gone through the link that you shared, do I have to include both <DiscussionEmbed .... > element and embed javascript variables to make it work ?
So here we have two identifiers right ? one identifier which we use in discuss config and another one is thread ID. I set the unique identifier and URL for disqus config but I am not sure how to setup page to generate unique thread ID.
from disqus-react.
You don't need to include the embed javascript variables, as those are handled within the DiscussionEmbed
component. So as long as the identifiers
that you are passing for each page are unique that shouldn't be a problem.
Since you are using Gatsby, in most cases you should be able to get a generated id
from the GraphQL query to ensure that they are unique.
Could you provide the url
and identifier
that you are providing to the DiscussionEmbed
component for each of your pages?
from disqus-react.
Sure.
Page 1
<DiscussionEmbed
shortname="xxxxxxx"
config={{
url: `http://${process.env.DISQUS_SITENAME}/power-of-attorney`,
identifier: "Power Of Attorney Comments Testing",
title: "Power Of Attorney Testing",
}}
Page 2
<DiscussionEmbed
shortname="xxxxxxx"
config={{
url: `http://${process.env.DISQUS_SITENAME}/rental-agreement`,
identifier: "Rental Agreement Comments Testing",
title: "Rental Agreement Testing",
}}
/>
from disqus-react.
Is ${process.env.DISQUS_SITENAME}
pointing to the production URL or localhost?
from disqus-react.
localhost for now to test from local
DISQUS_SITENAME=localhost:8000
from disqus-react.
There have been a few different issues that people have run into trying to use localhost to load the components locally as noted here, so you're going to want to have that point to the production URL.
Additionally, passing production and development URLs to the components with the same identifier
can cause conflicts when looking up the thread.
from disqus-react.
Ok. I will deploy these changes into production and test there. I will update status here.
from disqus-react.
You shouldn't actually have to deploy anything to production, you can just have it point to the production URL when running locally.
from disqus-react.
Right, Sure I will test that by changing URL in local
from disqus-react.
I changed DISQUS_SITENAME URL to production URL and tested. Same issue. Same comments are displayed on both pages.
from disqus-react.
That is likely because of the issue we've discussed.
Can you try providing the pages with a new identifier
or loading the component on a new page with a new url
and identifier
?
from disqus-react.
Awesome. Working now. thank you so much. Basically localhost was the issue.
from disqus-react.
I've noticed all my posts try to fetch one specific thread. Could you please explain how are these numbers obtained?
from disqus-react.
I'm trying to use DiscussionEmbed
in a next.js
app and when the page is soft reloaded I have the error
Uncaught TypeError: Cannot read property 'appendChild' of null
at k (asfernandes-blog.disqus.com/recommendations.js:32)
at Object.l [as isSerif] (asfernandes-blog.disqus.com/recommendations.js:32)
at h.i.toJSON (asfernandes-blog.disqus.com/recommendations.js:32)
at Object.c.initRecommendations (asfernandes-blog.disqus.com/recommendations.js:33)
at Object.c.reset (asfernandes-blog.disqus.com/recommendations.js:33)
at Object.c.reset (asfernandes-blog.disqus.com/embed.js:49)
at DiscussionEmbed.loadInstance (webpack-internal:///./node_modules/disqus-react/lib/DiscussionEmbed.js:77)
at DiscussionEmbed.componentDidMount (webpack-internal:///./node_modules/disqus-react/lib/DiscussionEmbed.js:57)
at commitLifeCycles (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:20658)
at commitLayoutEffects (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:23421)
at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:3945)
at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:3994)
at invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4056)
at commitRootImpl (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:23146)
at unstable_runWithPriority (webpack-internal:///./node_modules/scheduler/cjs/scheduler.development.js:468)
at runWithPriority$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:11276)
at commitRoot (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:22985)
at performSyncWorkOnRoot (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:22324)
at eval (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:11327)
at unstable_runWithPriority (webpack-internal:///./node_modules/scheduler/cjs/scheduler.development.js:468)
at runWithPriority$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:11276)
at flushSyncCallbackQueueImpl (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:11322)
at flushSyncCallbackQueue (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:11309)
at scheduleUpdateOnFiber (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:21888)
at updateContainer (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:25477)
at legacyRenderSubtreeIntoContainer (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26032)
at Object.render (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26098)
at renderReactElement (webpack-internal:///./node_modules/next/dist/client/index.js:598)
at doRender (webpack-internal:///./node_modules/next/dist/client/index.js:771)
at _callee2$ (webpack-internal:///./node_modules/next/dist/client/index.js:485)
at tryCatch (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:63)
at Generator.invoke [as _invoke] (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:293)
at Generator.eval [as next] (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:118)
at asyncGeneratorStep (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:3)
at _next (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:25)
at eval (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:32)
at new Promise (<anonymous>)
at eval (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:21)
at render (webpack-internal:///./node_modules/next/dist/client/index.js:459)
at Router.subscription [as sub] (webpack-internal:///./node_modules/next/dist/client/index.js:406)
at Router.notify (webpack-internal:///./node_modules/next/dist/next-server/lib/router/router.js:1538)
at Router.set (webpack-internal:///./node_modules/next/dist/next-server/lib/router/router.js:1214)
at Router._callee$ (webpack-internal:///./node_modules/next/dist/next-server/lib/router/router.js:913)
at tryCatch (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:63)
at Generator.invoke [as _invoke] (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:293)
at Generator.eval [as next] (webpack-internal:///./node_modules/regenerator-runtime/runtime.js:118)
at asyncGeneratorStep (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:3)
at _next (webpack-internal:///./node_modules/@babel/runtime/helpers/asyncToGenerator.js:25)
If I hit F5 the page works.
The component is used in my id
page.
from disqus-react.
This issue has gotten a little hard to follow with all of the various issues being brought up, so I think it's probably best to close this one out and allow people to create individual issues for any outstanding problems.
@asfernandes Can you create a new issue with the provided information and a link to public repo that can be used to reproduce your issue?
from disqus-react.
Related Issues (20)
- How do I get the image to load in the preview part of the Disqus homepage? HOT 2
- React 18 Support HOT 3
- Got a bunch of error when using disquss with Nextjs also got a CORS HOT 3
- No new release after react 18 upgrade? HOT 1
- Add new language
- Code failing in production (NextJS)
- Color Scheme / Theme Not Working HOT 1
- Does this React component not support SSO feature? HOT 5
- Tree shaking - bundle size HOT 1
- A11y failures meaning my website isn't WCAG AA
- Broken link to register if the shortname is incorrect
- Document how to disable reactions
- TypeError: Super expression must either be null or a function HOT 5
- Add theme prop to switch between light and dark mode HOT 1
- No Callbacks Running
- Dark Mode (Tailwind) not working HOT 5
- May `DiscussionEmbedConfig` type need `remoteAuthS3` field?
- CommentCount.js:125 Uncaught TypeError: Cannot read properties of undefined (reading 'string')
- Uncaught Error with parseColor using OKLCH color format in Next.js HOT 4
- Error: Super expression must either be null or a function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from disqus-react.