Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Menu Items via the Admin Panel - Adding More Than One Child Item Not Working #15727

Closed
smanny opened this issue Apr 10, 2024 · 8 comments · Fixed by #15766
Closed
Labels
Milestone

Comments

@smanny
Copy link

smanny commented Apr 10, 2024

When trying to add more than one child item under a parent menu item then saving it reverts back to its original position in Admin.

I of course need to be able to add more than one item in a dropdown menu.

Examining in the Inspection window, it seems that maybe the Javascript isn't assigning the correct attribute values. See attached screenshot. (It may appear from the screenshot that it worked, but as soon as I "Publish" it reverts the position of the second child item back to the top level)

Screenshot 2024-04-10 at 6 44 10 PM
@sebastienros sebastienros added this to the 1.9 milestone Apr 11, 2024
@MikeAlhayek
Copy link
Member

@smanny did you try this with the latest preview or main? I know this was an issue that I fixed couple weeks ago.

@smanny
Copy link
Author

smanny commented Apr 13, 2024

@MikeAlhayek I got this from main. When I remove the local project reference OrchardCore.Menu from OrchardCore.Application.Cms.Targets and add the preview package reference from CloudSmith, the menu list disapears from the Admin panel. Am I missing something else?

@MikeAlhayek
Copy link
Member

I just tested the admin menu from the main branch and it seems to be working. Not sure what am I missing. Can you check your log files for additional clues?

Did you follow the 1.9.0 breaking changes log?

image

@smanny
Copy link
Author

smanny commented Apr 14, 2024

@MikeAlhayek Can the s, b, & c items be placed on the same level in your environment? I believe what you show there will output each child item under a new nested <ul>.

Looking for this:

<ul>
    <li>About
        <ul>
            <li>s</li>
            <li>b</li>
            <li>c</li>
        </ul>
    </li>
</ul>

I can add one sub-item or sub-sub items, but not more than one on the same level.

I will look at the breaking changes log. I didn't see that.

@MikeAlhayek
Copy link
Member

@smanny I am not sure I understand the issue you are raising. Here is what I see using main branch.

image

I am also able to add more items and publish with no issue

image

If you still think there is something I am missing, please provide steps to reproduce the issue along with the expected results.

@smanny
Copy link
Author

smanny commented Apr 15, 2024

@MikeAlhayek The issue I am referring to is if you were to try and put (from your example) s, b, c, d on the same level. Right now, b is a child of s. C is a child of b etc. Are you able on your end to put those s, b, c, and d links as siblings? The outcome would create a dropdown under About with four child options (no flyouts). See my original attached image. When I try to put test 1 and test 2 together as siblings under Contact and publish, the second (or more) siblings will revert back to the top level. The system cannot save more than one sibling item together which would create an output like:

<ul>
    <li>About
        <ul>
            <li>s</li>
            <li>b</li>
            <li>c</li>
        </ul>
    </li>
</ul>

Rather than like:

<ul>
    <li>About
        <ul>
            <li>s
                <ul>
                     <li>b
                         <ul>
                             <li>c</li>
                         </ul>
                     </li>
               </ul>
            </li>
        </ul>
    </li>
</ul>

For example try this type of configuration:
Screenshot 2024-04-15 at 2 49 37 PM

@MikeAlhayek
Copy link
Member

@smanny The issue only happens with you have more than one child and try to move them out of their current parent to a main node. The driver actually throws an exception.

I was able to re-produce it and fix it in PR #15766

OrchardCore.Menu.Drivers.MenuPartDisplayDriver by InvalidOperationException System.InvalidOperationException: The node already has a parent.
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_NodeAlreadyHasParent()
   at System.Text.Json.Nodes.JsonObject.SetItem(String propertyName, JsonNode value)
   at OrchardCore.Menu.Drivers.MenuPartDisplayDriver.ProcessItem(MenuItemsListPart originalItems, JsonObject item) in C:\Code\OrchardCMS\OrchardCore\src\OrchardCore.Modules\OrchardCore.Menu\Drivers\MenuPartDisplayDriver.cs:line 124
   at OrchardCore.Menu.Drivers.MenuPartDisplayDriver.UpdateAsync(MenuPart part, IUpdateModel updater) in C:\Code\OrchardCMS\OrchardCore\src\OrchardCore.Modules\OrchardCore.Menu\Drivers\MenuPartDisplayDriver.cs:line 81
   at OrchardCore.ContentManagement.Display.ContentDisplay.ContentPartDisplayDriver`1.OrchardCore.ContentManagement.Display.ContentDisplay.IContentPartDisplayDriver.UpdateEditorAsync(ContentPart contentPart, ContentTypePartDefinition typePartDefinition, UpdateEditorContext context) in C:\Code\OrchardCMS\OrchardCore\src\OrchardCore\OrchardCore.ContentManagement.Display\ContentDisplay\ContentPartDisplayDriverTPart.cs:line 240
   at OrchardCore.ContentManagement.Display.ContentItemDisplayCoordinator.<>c.<<UpdateEditorAsync>b__9_0>d.MoveNext() in C:\Code\OrchardCMS\OrchardCore\src\OrchardCore\OrchardCore.ContentManagement.Display\ContentDisplay\ContentItemDisplayCoordinator.cs:line 347

@smanny
Copy link
Author

smanny commented Apr 15, 2024

@MikeAlhayek Thank you much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants