1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Post/conversation/edit appears not to save and progress bar keeps running

Discussion in 'Troubleshooting and Problems' started by popr, Aug 31, 2015.

  1. popr

    popr Active Member

    With XF 1.5.0, sometimes, a post/conversation/edit appears not to save (progress bar keeps running) but does save if you reload.

    This does not happen every time, and I have not figured out when/why it occurs. It occurs maybe 10-15% of the time randomly. If I create a post, edit one, or create a conversation, sometimes the progress bar will just keep loading forever and the page won't refresh. If you do reload or go to another page, the post is saved. I had several users report this after I upgraded to XF 1.5. I also recently upgraded to Flat Awesome for 1.5.0 and the only other thing I added was "Stay logged in checked by default."
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Can you recall what the content was of any of these things that wouldn't post?

    A common cause for this is usually browser extensions, specifically ad blockers, that take exception to the content you're posting and mistake it for something related to advertising.
     
  3. popr

    popr Active Member

    Thanks for the reply. All I did was post plain text messages with things like "test 7 of seeing if this posts immediately." I have my adblocker disabled for my forum.
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    Those times it does fail, is there anything logged in the browser console?

    Do you have any other browser extensions?
     
  5. popr

    popr Active Member

    I think I have discovered one way to reproduce it. It seems to almost always (if not always) happen when it's a post that will appear on the next page. For example, with 10 posts per page, if I'm one page 2 of a thread and making post #21, it will do it. This is a case where it takes you to a new page instead of the same one you're on (but your post temporarily appears like it went on page 2 due to ajax).

    I have several other chrome browser extensions. Lastpass, Awesome Screenshot, Adblock Plus (disabled on my site), OneTab, Session Buddy, Page Monitor, Mighty Text, Google Voice, Hover Hound, Image Properties Context Menu, No Mousewheel Zoom, The Camelizer.

    I've never had this happen elsewhere with all those extensions. Seems to coincide with 1.5.0 though I can't be 100%. I disabled 2 plugins just in case (stay logged in and Alert Icons Management).. still happened. It's also happening to several other users who brought it to my attention.
     
  6. popr

    popr Active Member

    Aha.. I think I caught something in the browser console. When I tried to edit a post...

    Uncaught Error: adsbygoogle.push() error: Cannot find a responsive size for a container of width=0px and height=undefinedpx data-ad-format=auto

    I do use google's responsive ad size.
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    I can say with some degree of certainty that such a think won't be caused by any new code in XF1.5 as for the most part the areas in effect here have remained untouched.

    The ads error could be significant.

    The easiest way to test that, now, is to create a new style with no parent, and activate that style. That would be the XenForo default and unedited style. If you have any add-ons that inject the ads into places, you will also need to temporarily disable those. Then try to see if you can still replicate the issue.
     
  8. popr

    popr Active Member

    I'm pretty sure it's the google responsive ad that's causing it. I will test it with the default style and without ads. Have any ideas on fixing this code? It looks like the browser console just stops the moment it gets that error from google not finding a spot for it's ad. I think the problem is it's trying to create another new responsive ad after/before the new post in certain conditions. Here's my code


    Code:
    ----ad_above_content----
    <xen:hook name="ad_above_content" />
    
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-XXX"
         data-ad-slot="XXX"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    
    
    ----ad_message_below----
    <xen:hook name="ad_message_below" />
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-XXX"
         data-ad-slot="XXX"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    <br><br><br><br><br><br>
    </xen:if>
    
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 9 AND !{$message.conversation_id}">
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-XXX"
         data-ad-slot="XXX"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    <br><br><br><br><br><br>
    </xen:if>
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    I'm not 100% sure, but judging by the error it seems like the ads are trying to display before the actual post itself displays.

    There may be better ways of doing this, such as looking for the window on load event or similar, but this might work also. Change all cases of:
    Code:
     adsbygoogle = window.adsbygoogle || []).push({});
    With the following:
    Code:
    window.setTimeout(function(){
      (adsbygoogle = window.adsbygoogle || []).push({});
    }, 250);
     

Share This Page