Skip to content

Removed code duplication and unset event listeners#9262

Merged
bsekachev merged 1 commit intodevelopfrom
bs/fixed_extra_listeners
Mar 27, 2025
Merged

Removed code duplication and unset event listeners#9262
bsekachev merged 1 commit intodevelopfrom
bs/fixed_extra_listeners

Conversation

@bsekachev
Copy link
Member

@bsekachev bsekachev commented Mar 25, 2025

Motivation and context

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
35.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.17%. Comparing base (2f110e5) to head (ef6d6d3).
Report is 5 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9262      +/-   ##
===========================================
- Coverage    74.17%   74.17%   -0.01%     
===========================================
  Files          428      429       +1     
  Lines        44964    44970       +6     
  Branches      3917     3918       +1     
===========================================
+ Hits         33352    33356       +4     
- Misses       11612    11614       +2     
Components Coverage Δ
cvat-ui 77.23% <100.00%> (-0.01%) ⬇️
cvat-server 71.63% <88.88%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bsekachev bsekachev requested a review from Copilot March 27, 2025 11:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reduces code duplication and improves event listener management on the quality control and consensus management pages while also refining URL hash updates.

  • Removes duplicate definitions of getTabFromHash by importing a shared utility function.
  • Implements proper cleanup of hashchange event listeners using a named callback.
  • Substitutes window.location.hash assignment with window.history.replaceState for better URL management in consensus management.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/utils/location-utils.ts Introduces a shared utility for hash extraction to reduce duplication.
src/components/quality-control/quality-control-page.tsx Replaces the internal getTabFromHash with the imported version and enhances event listener cleanup.
src/components/consensus-management-page/consensus-management-page.tsx Applies similar improvements as quality control and refines URL hash updates using history.replaceState.

@bsekachev bsekachev merged commit 2054e90 into develop Mar 27, 2025
33 of 34 checks passed
@bsekachev bsekachev deleted the bs/fixed_extra_listeners branch March 27, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments