cgkineo / adapt-pageNav

Navigation bar component (quicknav clone)
GNU General Public License v3.0
6 stars 4 forks source link

Using _customRouteId in grouped topics is broken #69

Closed swashbuck closed 4 months ago

swashbuck commented 4 months ago

Subject of the issue

Using _customRouteId for a button is broken if a valid model cannot first be found for the type. For example, if there is no "next" sibling content object in a menu group and you set the _customRouteId to the first content object in the next group, the button will not be shown.

When the code goes through and gets the valid models (e.g. get the next sibling content object for the _next button model), it will exit if no model is found.

https://github.com/cgkineo/adapt-pageNav/blob/330a72b5bdeb2a843efa1e98e60aed169c07fd9f/js/PageNavModel.js#L45-L46

So, it never gets a chance to check for a _customRouteId:

https://github.com/cgkineo/adapt-pageNav/blob/330a72b5bdeb2a843efa1e98e60aed169c07fd9f/js/PageNavModel.js#L48-L50

Your environment

Steps to reproduce

Set up a menu with grouping. Each group contains one topic:

For the _next button in co-100, set the _customRouteId to co-200 since it can't naturally find what the next content object is.

For the _previous button in co-200, set the _customRouteId to co-100 since it can't naturally find what the previous content object is.

Expected behaviour

The Next button in co-100 and the Previous button in co-200 should both be visible.