MurhafSousli/ngx-disqus

"Advanced usage" passing identifiers not working

Closed this issue · 8 comments

Hi Murhaf,

Thank you for the awesome component!

No matter what I pass as [identifier]="pageIdentifier" or [url]="customUrl" [categoryId]="catId", the final iframe always loads the URL. This seems to be a bug?

Disqus is ignoring my Angular2 routing, and therefore I need to be able to set identifiers and URLs manually to the item.

my code:

<disqus [shortname]="'superjuice-cc'" [identifier]="'identifier'"
[url]="'identifier'" >

Loads this iframe in the browser:

<iframe id=​"dsq-app1" name=​"dsq-app1" allowtransparency=​"true" frameborder=​"0" scrolling=​"no" tabindex=​"0" title=​"Disqus" width=​"100%" src=​"https:​/​/​disqus.com/​embed/​comments/​?​base=default&​version=363a88bef35291d2372470008ca7e3b0&​f=superjuice-cc&​t_u=http%3A%2F%2Fsuperjuice.cc%2FNew&​t_d=Superjuice&​t_t=Superjuice&​s_o=default" horizontalscrolling=​"no" verticalscrolling=​"no" style=​"width:​ 1px !important;​ min-width:​ 100% !important;​ border:​ none !important;​ overflow:​ hidden !important;​ height:​ 569px !important;​">​

=>always the same comments.

Hi @nikodunk, I just noticed the issue now, I updated the module to 1.0.4, reinstall it and let me know if you still got an issue

I am not saying I know how to fix it, but this is what is going:

When ngAfterViewInit runs, the object window.DISQUS is undefined. So DISQUS.reset doesn't run.

I have been playing with it and this is how I got it to work, I can open a PR later.

ngAfterViewInit : addSriptTag

ngAfterViewChecked: check flag to see if reset has been ran, if not, run DISQUS.reset with advanced options, then set flag so it doesn't repeatedly run reset

not very elegant, but it does work.

@csawtelle I have fixed this issue using ngOnChanges, and I tested it. disqus_config gets changed values and disqus reloads, but they are not effecting. it could be DISQUS bug.. still need more investigation

Unfortunately, the latest update doesn't fix the problem on my end. Still ignores "[identifier]", etc.

Here is a gist of a hacky way I got it to work. It really comes down to timing I think.

https://gist.github.com/csawtelle/d1beebfc62682902a09459c7af37e7d0

@csawtelle ngAfterViewChecked shouldn't be used in our case

Thanks for this great npm but Somehow in updated version also, identifier is is still not changing