Giter Club home page Giter Club logo

Comments (3)

plumduffer avatar plumduffer commented on August 22, 2024

My workaround for the time being:

{% set primaryNavigation = craft.navigation.nodes('primaryNavigation').all() %}

{% for navItem in primaryNavigation|filter(x => x.level == 1) %}
    {% set childrenNav = primaryNavigation|filter(x => x.level > 1 and x.parent.id == navItem.id) %}
{% endfor %}

And so on.

from navigation.

mightyfineyall avatar mightyfineyall commented on August 22, 2024

Having this issue as well. On a local dev site with only 3 nodes and one subnode:

Without eager loading (children called using .all()):

image

With eager loading as per docs:

image

Removing the Navigation query entirely, leaving everything else:

image

Interestingly enough, ripping everything out of the header file except for this one line:

{% set primaryNodes = craft.navigation.nodes('headerNavigation').level(1).with(['children']).all() %}

Still leaves us at 100ms:

image

That's odd.

@plumduffer updated my local to 4.3.8.2 and it seems to be fixed, likely related to craftcms/cms#12648:

image

from navigation.

engram-design avatar engram-design commented on August 22, 2024

There have been some rough issues with eager loading in Craft itself, so be sure to get updated before proceeding further.

However, the lack of eager-loading nodes is a well-known issue. While the nodes themselves can be eager-loaded, the linked-to elements cannot and is at the moment a Craft limitation.

from navigation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.