Caching issues with filters
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3211656. -->
Reported by: [steva1982](https://www.drupal.org/user/1432586)
Related to !3
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Hi, I have a website with this menu:</p>
<pre>{<br> "jsonapi": {<br> "version": "1.0",<br> "meta": {<br> "links": {<br> "self": {<br> "href": "http://jsonapi.org/format/1.0/"<br> }<br> }<br> }<br> },<br> "data": [<br> {<br> "type": "menu_link_content--menu_link_content",<br> "id": "standard.front_page",<br> "attributes": {<br> "description": "",<br> "enabled": true,<br> "expanded": false,<br> "menu_name": "main",<br> "meta": [],<br> "options": [],<br> "parent": "",<br> "provider": "standard",<br> "route": {<br> "name": "<front>",<br> "parameters": []<br> },<br> "title": "Home",<br> "url": "/export/web/it",<br> "weight": "0"<br> }<br> },<br> {<br> "type": "menu_link_content--menu_link_content",<br> "id": "menu_link_content:d7782fb2-b42e-4783-afb0-8aaad9d8a090",<br> "attributes": {<br> "description": null,<br> "enabled": true,<br> "expanded": false,<br> "menu_name": "main",<br> "meta": {<br> "entity_id": "1"<br> },<br> "options": [],<br> "parent": "",<br> "provider": "menu_link_content",<br> "route": {<br> "name": "entity.node.canonical",<br> "parameters": {<br> "node": "3"<br> }<br> },<br> "title": "articolo 1 it",<br> "url": "/export/web/it/articolo-1-it",<br> "weight": "0"<br> }<br> },<br> {<br> "type": "menu_link_content--menu_link_content",<br> "id": "menu_link_content:a6892f81-658a-48cf-8cf6-e2dedb45d8e7",<br> "attributes": {<br> "description": null,<br> "enabled": true,<br> "expanded": false,<br> "menu_name": "main",<br> "meta": {<br> "entity_id": "5"<br> },<br> "options": {<br> "attributes": {<br> "class": [<br> "classe-sottolink"<br> ],<br> "id": "mio-id",<br> "target": "_blank"<br> }<br> },<br> "parent": "menu_link_content:d7782fb2-b42e-4783-afb0-8aaad9d8a090",<br> "provider": "menu_link_content",<br> "route": {<br> "name": "entity.node.canonical",<br> "parameters": {<br> "node": "10"<br> }<br> },<br> "title": "sotto articolo 1a it",<br> "url": "/export/web/it/sotto-articolo-1a-it",<br> "weight": "0"<br> }<br> },<br> {<br> "type": "menu_link_content--menu_link_content",<br> "id": "menu_link_content:60bc9c14-0623-471e-89ce-a394a3aec781",<br> "attributes": {<br> "description": null,<br> "enabled": true,<br> "expanded": false,<br> "menu_name": "main",<br> "meta": {<br> "entity_id": "7"<br> },<br> "options": [],<br> "parent": "menu_link_content:a6892f81-658a-48cf-8cf6-e2dedb45d8e7",<br> "provider": "menu_link_content",<br> "route": {<br> "name": "entity.node.canonical",<br> "parameters": {<br> "node": "11"<br> }<br> },<br> "title": "sotto sotto art it",<br> "url": "/export/web/it/sotto-sotto-art-it",<br> "weight": "0"<br> }<br> },<br> {<br> "type": "menu_link_content--menu_link_content",<br> "id": "menu_link_content:fe6b16af-13a6-4fb8-a361-74d2490dd157",<br> "attributes": {<br> "description": null,<br> "enabled": true,<br> "expanded": false,<br> "menu_name": "main",<br> "meta": {<br> "entity_id": "2"<br> },<br> "options": [],<br> "parent": "",<br> "provider": "menu_link_content",<br> "route": {<br> "name": "entity.node.canonical",<br> "parameters": {<br> "node": "4"<br> }<br> },<br> "title": "articolo 2 solo it",<br> "url": "/export/web/it/articolo-2-solo-it",<br> "weight": "0"<br> }<br> },<br> {<br> "type": "menu_link_content--menu_link_content",<br> "id": "menu_link_content:b18e8481-a7b1-459c-b296-5a528fff390c",<br> "attributes": {<br> "description": null,<br> "enabled": true,<br> "expanded": false,<br> "menu_name": "main",<br> "meta": {<br> "entity_id": "3"<br> },<br> "options": [],<br> "parent": "",<br> "provider": "menu_link_content",<br> "route": {<br> "name": "entity.node.canonical",<br> "parameters": {<br> "node": "5"<br> }<br> },<br> "title": "articolo 3 solo en",<br> "url": "/export/web/it/node/5",<br> "weight": "0"<br> }<br> },<br> {<br> "type": "menu_link_content--menu_link_content",<br> "id": "menu_link_content:e439be27-b0ef-4718-8d2c-2f7ea78abd7d",<br> "attributes": {<br> "description": null,<br> "enabled": true,<br> "expanded": false,<br> "menu_name": "main",<br> "meta": {<br> "entity_id": "4"<br> },<br> "options": {<br> "query": []<br> },<br> "parent": "",<br> "provider": "menu_link_content",<br> "route": {<br> "name": "view.elenco_it.page_1",<br> "parameters": []<br> },<br> "title": "elenco it",<br> "url": "/export/web/it/elenco-it",<br> "weight": "0"<br> }<br> },<br> {<br> "type": "menu_link_content--menu_link_content",<br> "id": "menu_link_content:03c078b1-4b69-4568-bb1d-e968d6ea2048",<br> "attributes": {<br> "description": null,<br> "enabled": true,<br> "expanded": false,<br> "menu_name": "main",<br> "meta": {<br> "entity_id": "6"<br> },<br> "options": {<br> "external": true<br> },<br> "parent": "",<br> "provider": "menu_link_content",<br> "route": {<br> "name": "",<br> "parameters": []<br> },<br> "title": "link esterno it",<br> "url": "https://www.usi.ch/it",<br> "weight": "0"<br> }<br> }<br> ],<br> "links": {<br> "self": {<br> "href": "http://localhost:8888/export/web/it/jsonapi/menu_items/main"<br> }<br> }<br>}</pre><p>where there are:</p>
<ul>
<li>6 first-level menu items</li>
<li>1 second-level menu item</li>
<li>1 third-level menu item</li>
</ul>
<p>I am trying to add a simple filter from the README.md file:<br>
<a href="http://export:export@localhost:8888/export/web/it/jsonapi/menu_items/main?filter[max_depth]=1">http://export:export@localhost:8888/export/web/it/jsonapi/menu_items/main?filter[max_depth]=1</a></p>
<p>but in the output there are always 8 menu items.<br>
What am I getting wrong?<br>
Thank you very much.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Create a menu with different levels.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue