-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
readyToBind fix #296
readyToBind fix #296
Conversation
Using boolean for readyToBind wasn't enough for reload, since watch doesn't get triggered if "loaded = true;" was set on angular's routeChangeSuccess event (probably because the value actually doesn't change). Therefore 'isReady & boolean' was replaced with 'loadedOn / DateTime' and since on each call there is a new value, readyToBind gets triggered.
Michael hi, |
Hi, Thanks for the PR. Yes, I think it would help if you could provide more context in the form of code that does not work with the current implementation. Also could you tell me if this change will change the public API in any way? It looks to me like you could now pass any value to |
Michael hi, When I check it again, I managed to handle the case without modifying your file. Please check these two pages;
dirDisqus.js file is your original file, except there is an extra console.log at line 54; In both cases navigate between views, Home, View1, View2 and check the console logs. First case (default_boolean.aspx) uses disqusLoaded boolean. In main.js check line 19 - 20; Second case uses disqusLoadedOn, in main.js check line 24; In your README page, you suggest using boolean values when the content is ready, which is actually correct in one time/async content case. So, what I would suggest is to update your README file by adding something like this - and close this PR without merging;
However, I believe, it would be a much better approach if there would be a watch on "disqusId" itself and update the comments, instead of having this extra "readyToBind". If there is a value for disqusId (disqusId !== ''), load or refresh the related comments, else, don't load disqus. Covers all 3 cases (sync, async comments, routeChanges). And last, in any case, it would be great if you could remove or comment out this line from dirDisqus.js. Kind regards, PS: Now when I tried opening my links (default.aspx pages) with Firefox, it kept loading them until it fails. In Chrome and Edge, it looks good. Let me know if you have an issue with loading the pages. |
Hi, Thanks for the detailed response. I agree with all your proposals. In this PR, you also fixed a number of clumsy style issues (as well as the console.log - duh! :) ). If you have time to implement what you propose that would be great. I am also super short on free time at the moment, and in the little time I have for OSS projects, I am working on an Angular2 pagination port. I am fine with making a breakingchange to the API (especially as it is simpler) since I am using sermver versioning on the bower version, so people can avoid it if they want. Also, I don't think this module is very widely used anyway as far as I am aware (compared to, say the pagination one). |
Using boolean for readyToBind wasn't enough for reload, since watch
doesn't get triggered if "loaded = true;" was set on angular's
routeChangeSuccess event (probably because the value actually doesn't
change).
Therefore 'isReady & boolean' was replaced with 'loadedOn / DateTime'
and since on each call there is a new value, readyToBind gets triggered.