putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
147 stars 35 forks source link

Blitz Hints inaccurate report? #643

Closed MattWilcox closed 3 months ago

MattWilcox commented 3 months ago

Bug Report

Hi Ben,

I have a few items being shown in the Blitz Hints area, and I'm not sure if they're genuine (I've messed up) or not (the plugin's not detecting the loading correctly).

For example, I have "Eager load the Matrix Builder".

If I look at that template, the way I was doing it triggers this warning, but doing the same thing and stashing it into a variable stops it being reported.

        {% include '_partials/matrixBuilder.twig' with {
            'matrixField': entry.matrixBuilder.eagerly().collect(),
            'groupSeries': false
        } %}

^ Triggers the warning.

        {% set theFieldData = entry.matrixBuilder.eagerly().collect() %}
        {% include '_partials/matrixBuilder.twig' with {
            'matrixField': theFieldData,
            'groupSeries': false
        } %}

^ Does not trigger the warning.

It feels like there should be no functional difference here?

I also have warnings for a fair few nested items that I am calling .eagerly() on, but are showing up here. I'm not sure if that's me messing up, or not.

Let me know if you want the templates / DB. It's just a starter project with miminal content.

Plugin Version

5.0.0-beta.2

Craft CMS Version

5.0-beta.10

PHP Version

8.2

bencroker commented 3 months ago

Thanks for the issue Matt, but the Blitz Hints utility is not yet working 100% with Craft 5. It’s high on my list of things to work on and it should be complete once the stable version of Blitz 5 is out. I’ll notify you of that here.

MattWilcox commented 3 months ago

Oh, Sorry Ben - I read the last release notes and thought you'd got it working, hence testing it! Mis-understood.

bencroker commented 3 months ago

No problem, it gave me the nudge I needed to fix and release in 5.0.0-beta.3.