graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

Fix client-side routing in `MenuItem` component.

Open dennisoelkers opened this issue 9 months ago • 0 comments

Note: This should be backported to 6.0.

Description

Motivation and Context

With the migration of the MenuItem component to Mantine, we introduced a regression leading to client-side routing (rendering a new page without a full page refresh) not working when an href prop is passed to the MenuItem component.

This PR is now fixing this by constructing a custom onClick handler when the href prop is specified, is a relative URL and target/rel are not specified.

A future refactoring should consolidate target & rel props into a openNewPage prop for ease of use and consistency of rel options (some usages do not specify noopener/noreferrer). To make backporting this fix easier, this will be performed in a separate PR.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Refactoring (non-breaking change)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.

dennisoelkers avatar May 02 '24 09:05 dennisoelkers