You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(FR-1509): fix sidebar menu sorting inconsistency across browsers (#4329)
Resolves#4328 ([FR-1509](https://lablup.atlassian.net/browse/FR-1509))
## Summary
Fixes a browser-specific bug where non-group menu items appear at the end of the sidebar menu in Firefox, while they display correctly at the beginning in Chrome and Safari.
## Root Cause
Different JavaScript engines (V8 in Chrome, SpiderMonkey in Firefox, JavaScriptCore in Safari) may pass items to the sort callback in different orders. The original sorting logic didn't properly handle non-group items that weren't in the predefined order array, causing inconsistent comparison results depending on the callback order.
## Changes
- Implement explicit weight-based sorting for both group and non-group items
- Assign negative weight (-1) to non-group items to ensure they always appear first
- Properly handle group items not in the predefined order by assigning them maximum weight
- Ensure consistent sorting results regardless of JavaScript engine implementation
- Remove TypeScript ignore comments and improve type safety
## Testing
- Verified menu ordering is consistent across Firefox, Chrome, and Safari
- Non-group items now properly appear at the beginning of the menu in all browsers
- Group items maintain correct predefined order
This fix ensures consistent menu ordering across all browsers by making the sorting logic deterministic and independent of the JavaScript engine's sort implementation details.
[FR-1509]: https://lablup.atlassian.net/browse/FR-1509?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
0 commit comments