Skip to content

fix: reset button#12024

Open
olayinkaadelakun wants to merge 1 commit intorelease-1.8.0from
LE-478
Open

fix: reset button#12024
olayinkaadelakun wants to merge 1 commit intorelease-1.8.0from
LE-478

Conversation

@olayinkaadelakun
Copy link
Collaborator

Description

The initial issue was that clicking Reset on a single shortcut did not return it to the system default. Instead, it reverted to the last saved/custom value, because the reset logic was based on the current shortcut list (which already included the user’s edits) rather than the original default list. The only way to truly restore defaults was the Restore button, which reset all shortcuts at once.

Refactored the shortcut editing logic into helpers and reduced inline logic in the component to improve readability and testability. The main component now calls these helpers and uses a dedicated reset handler instead of inline onClick logic, so the UI behavior is clearer and easier to maintain.

Added a helper module that centralizes shortcut lookup, duplication checks, normalization, and key-combination formatting. This makes those behaviors reusable and straightforward to unit test.

Added unit tests covering the helper behaviors (lookup, duplication detection, normalization, key formatting).

Before
https://github.com/user-attachments/assets/e4322f02-5cc0-41d3-a0d7-f1227c3aad02

After
https://github.com/user-attachments/assets/8c7b0619-8bda-4e91-b2a3-10229d6e6b4e

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch LE-478

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 23%
23.14% (8079/34910) 15.82% (4329/27358) 16.02% (1178/7352)

Unit Test Results

Tests Skipped Failures Errors Time
2618 0 💤 0 ❌ 0 🔥 43.582s ⏱️

Copy link
Collaborator

@viktoravelino viktoravelino left a comment

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions bot added the lgtm This PR has been approved by a maintainer label Mar 3, 2026
@viktoravelino viktoravelino changed the title fix reset button fix: reset button Mar 3, 2026
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 57.14286% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.13%. Comparing base (a25aa8c) to head (fc34441).
⚠️ Report is 1 commits behind head on release-1.8.0.

Files with missing lines Patch % Lines
...e/pages/ShortcutsPage/EditShortcutButton/index.tsx 46.87% 13 Missing and 4 partials ⚠️
.../pages/ShortcutsPage/EditShortcutButton/helpers.ts 70.83% 0 Missing and 7 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                @@
##           release-1.8.0   #12024      +/-   ##
=================================================
+ Coverage          37.05%   37.13%   +0.08%     
=================================================
  Files               1588     1589       +1     
  Lines              77969    77983      +14     
  Branches           11803    11807       +4     
=================================================
+ Hits               28893    28962      +69     
+ Misses             47454    47370      -84     
- Partials            1622     1651      +29     
Flag Coverage Δ
backend 57.34% <ø> (+0.01%) ⬆️
frontend 20.69% <57.14%> (+0.18%) ⬆️
lfx 41.50% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...c/pages/SettingsPage/pages/ShortcutsPage/index.tsx 0.00% <ø> (ø)
.../pages/ShortcutsPage/EditShortcutButton/helpers.ts 70.83% <70.83%> (ø)
...e/pages/ShortcutsPage/EditShortcutButton/index.tsx 57.53% <46.87%> (+57.53%) ⬆️

... and 6 files with indirect coverage changes

🚀 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.

@github-actions github-actions bot added the bug Something isn't working label Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants