• Resolved timholz

    (@timholz)


    Hi
    I am experimenting with a rest api service. I render books on a website.
    When i have autoptimize disabled the books drop in one by one or in chunks rather quickly. That is the desired behaviour.
    When i enable autoptimize the browser waits a long time and then displays the books all at once.
    I’ve tried to alter the autoptimize settings, no change.
    Could there be a conflict with my code and if what could cause the problem?
    My setup is rather simple:
    A header
    A Form with an Input
    A Button that gets the value from the input and triggers a php function
    A Footer
    Does anyone have an idea what causes the blocking of continous rendering?
    regards
    theo

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Frank Goossens

    (@futtta)

    did you try excluding the JS the doos the rest calls?

    Thread Starter timholz

    (@timholz)

    Hi Frank
    Thanks for the message.
    I am doing the rest calls via php. I suppose there must be a conflict with my php function.
    regards
    theo

    Plugin Author Frank Goossens

    (@futtta)

    well, the rest calls are initiated in JS, no? it’s JS calling PHP? so if that JS is autoptimized it will be triggered late (due to the “defer” flag). if you exclude that JS (and dependencies) from JS optimization, that should allow it to function as intended.

    Thread Starter timholz

    (@timholz)

    No, the rest calls happen via php.
    wp_remote_get($url, $header)
    I’ll probably will have to switch to ajax.

    • This reply was modified 7 years, 9 months ago by timholz.
    Plugin Author Frank Goossens

    (@futtta)

    well, if no JS is used to fetch the remote content and no JS is used to render the content, then optimizing JS should not impact the speed at which the books fall. but “falling books” seems to indicate there’s rendering done in JS?

    Thread Starter timholz

    (@timholz)

    Also the rendering is done via php.
    The behaviour is strange. With AO active the browser waits until all the books are loaded and displays them at once. With AO inactive, the books almost immediatly start rendering one by one or in groups. That is what confuses me.
    Somehow AO changes the behaviour of my php function. Well, at least that is my modest conclusion…

    Plugin Author Frank Goossens

    (@futtta)

    well, PHP does not really render stuff; it spits out HTML which is used to do your basic page rendering, styled by CSS and additional rendering triggered by CSS and/ or JS.

    Somehow AO changes the behaviour of my php function.

    never say never, but that “never” happens ??

    can you share a URL where I can see this happening (with or without AO) @timholz?

    Thread Starter timholz

    (@timholz)

    Yes, you are right. Sorry, i didn’t in anyway critize your great plugin.
    You can go to: https://goethebuch.creatifpassion.ch/suchen/
    Please note, the site is in development. I disabled the password proctection.
    AO is now inactive

    Plugin Author Frank Goossens

    (@futtta)

    loading seems to me at first sight, but I’ll have a look later this evening.

    Sorry, i didn’t in anyway critize your great plugin.

    no problem, didn’t feel criticized, so … ??

    Thread Starter timholz

    (@timholz)

    Ok, i’ll turn AO on.

    Plugin Author Frank Goossens

    (@futtta)

    OK, I *suspect* that AO is having some difficulty parsing the HTML, which is pretty hefty to the amount of base64-ed inline images. additionally, as it’s a search-page, you can’t cache the HTML, so you take that hit each time again. I would first and foremost disable HTML minify and if that doesn’t change anything toggle all 3 on and off to see which ones have the biggest (or smallest) impact.

    If need be, you could exclude your search-page from autoptimization using a couple of lines of code against AO’s API.

    Thread Starter timholz

    (@timholz)

    Ok, thanks a lot for this analysis.

    I tested disabling the options. If all three are off it works.

    But this works:
    add_filter('autoptimize_filter_noptimize','my_ao_noptimize',10,0);

    I am really thankful for your help.
    Have a nice evening.
    theo

    • This reply was modified 7 years, 9 months ago by timholz.
    Plugin Author Frank Goossens

    (@futtta)

    you’re welcome Theo, enjoy the rest of your evening as well ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘autoptimize blocks rendering of rest api call’ is closed to new replies.