verbb / navigation

A Craft CMS plugin to create navigation menus for your site.
Other
90 stars 23 forks source link

Unable to move items if `Max Nodes per Level` is set #376

Closed sander-lameco closed 11 months ago

sander-lameco commented 12 months ago

Describe the bug

We have a navigation setup with the following config:

Now when the max nodes for level 1 is reached and we try to move one of the items as a child of one of the others we get the "A server error occurred` message. I went and checked the web.log but no errors where logged.

After debugging a bit I noticed when I delete one of the level 1 items and then moving another as a child of yet another one the error isn't triggered. After that I removed the Max Nodes per Level to see if it was the cause and it is. One thing I also noticed is the error only happens when you move an item to the first child position of another item.

Steps to reproduce

  1. Create a Navigation
  2. Set it up with a Max Nodes per Level for Level 1 set to 4 (or any other number)
  3. Add the max amount of items to the navigation to level 1
  4. Move a top level navigation item to another top level navigation

Craft CMS version

4.5.11.1

Plugin version

2.0.22

Multi-site?

No

Additional context

No response

engram-design commented 12 months ago

Fixed for the next release. To get this early, run composer require verbb/navigation:"dev-craft-4 as 2.0.22".

sander-lameco commented 12 months ago

@engram-design I'm not sure if this is introducing a new bug or I am missing something after doing the composer require step. I did clear all caches just in case but when I try to add a (few) pages from the modal it will give me this console error:

Uncaught TypeError: Cannot read properties of undefined (reading '$body')
    at s.constructor.onElementModalSelect (navigation.js:135:54)
    at Object.o [as onSelect] (jquery.js?v=1701249302:2:89408)
    at s.constructor.onSelect (BaseElementSelectorModal.js:353:21)
    at s.constructor.selectElements (BaseElementSelectorModal.js:308:14)
    at s.constructor.<anonymous> (Base.js:153:23)
    at HTMLButtonElement.o (jquery.js?v=1701249302:2:89408)
    at HTMLButtonElement.dispatch (jquery.js?v=1701249302:2:43392)
    at v.handle (jquery.js?v=1701249302:2:41387)
    at Object.trigger (jquery.js?v=1701249302:2:72081)
    at HTMLButtonElement.<anonymous> (jquery.js?v=1701249302:2:72677)
engram-design commented 12 months ago

Ah, slightly unrelated error, but also fixed for the next release. To get this early, run composer require verbb/navigation:"dev-craft-4 as 2.0.22".

engram-design commented 11 months ago

Fixed in 2.0.23