Stop issuable navigation after visiting a URL without a full path

What does this MR do and why?

A click on an item in the dashboard issues list logs TypeError: Cannot read properties of undefined (reading 'push').

IssuableItem#navigateToIssuable has a branch for lists that have no fullPath, such as the dashboard work items list. That branch calls visitUrl, but it has no return. The method then continues to canRouterNav:

  • With an empty fullPath, the project pattern becomes /-/(work_items|issues)(/\d+)?/?$, which matches every issue URL.
  • So canRouterNav returns true, and the method calls this.$router.push.
  • The dashboard has no Vue Router, so $router is undefined and the call throws.

The page still navigates, because visitUrl ran first. The error only appears in the console. This MR adds the missing return and removes the allowlist entry for this error.

References

Screenshots or screen recordings

The page looks the same before and after. The only change is that the console error is gone. These screenshots show local validation at 9283fb31: a click on the issue in the dashboard list opens the project issue page, and the browser console shows no push error.

Dashboard list (/dashboard/issues) After the click
dashboard_list issue_page

How to set up and validate locally

  1. Go to Issues on your dashboard (/dashboard/issues).
  2. Select the title of an issue. Before this change, the console shows the push error.

Automated checks:

  • The new Jest example in issuable_item_spec.js fails on master with the same TypeError and passes with this change.
  • spec/features/dashboard/issues_spec.rb:79 passes locally without the allowlist entry.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Miguel Rincon

Merge request reports

Loading
Loading