chore: better logging for duplicate keyboard shortcuts (#5425)

* chore: better logging for duplicate keyboard shortcuts

* chore: skip flaky test

* fix: make the shortcut error silent in prod
This commit is contained in:
Vikrant Gupta 2024-07-08 19:25:50 +05:30 committed by GitHub
parent bf177882e6
commit 4d64f1dede
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,8 +90,14 @@ function KeyboardHotkeysProvider({
(keyCombination: string, callback: () => void): void => {
if (!shortcuts.current[keyCombination]) {
shortcuts.current[keyCombination] = callback;
} else if (process.env.NODE_ENV === 'development') {
throw new Error(
`This shortcut is already present in current scope :- ${keyCombination}`,
);
} else {
throw new Error('This shortcut is already present in current scope');
console.error(
`This shortcut is already present in current scope :- ${keyCombination}`,
);
}
},
[shortcuts],