Comments (3)
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.
Having this issue as well. On a local dev site with only 3 nodes and one subnode:
Without eager loading (children called using .all()):
With eager loading as per docs:
Removing the Navigation query entirely, leaving everything else:
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:
That's odd.
@plumduffer updated my local to 4.3.8.2 and it seems to be fixed, likely related to craftcms/cms#12648:
from navigation.
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)
- When "Max nodes per level" reached no node move possible HOT 2
- Changing country in multi site setup - select entry still links to content from previous site HOT 2
- Ability to edit "Open in new window" property for already created nodes HOT 2
- Unable to move items if `Max Nodes per Level` is set HOT 4
- Nodes become uneditable after saving HOT 1
- Craft 5 tests - verbb/base requires wrong version HOT 6
- When using paginate tag getActiveNode does not return active node HOT 3
- Installed or No? HOT 3
- craft.navigation.render() doesn't use custom title HOT 6
- Point a navigation entry to a "bookmark" global HOT 9
- Spacing is a bit weird after entering a new link. HOT 2
- Query returns NULL in CP preview HOT 4
- Nodes are not removed when related entry section is removed
- Restore node if related entry was restored after it was deleted
- Error 500 trying to edit a navigation element [3.0] [Craft 5] HOT 3
- Site / language switcher is broken in Navigation's breadcrumb [3.0] [Craft 5] HOT 5
- Blitz cache not clearing when new item is added HOT 2
- Entries Subsets (Selectable Entries Condition) HOT 1
- Exclude entries without URI in the selection window HOT 4
- Unable to save due to https > http mixed content error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from navigation.