mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 09:28:58 +08:00
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:
parent
bf177882e6
commit
4d64f1dede
@ -90,8 +90,14 @@ function KeyboardHotkeysProvider({
|
|||||||
(keyCombination: string, callback: () => void): void => {
|
(keyCombination: string, callback: () => void): void => {
|
||||||
if (!shortcuts.current[keyCombination]) {
|
if (!shortcuts.current[keyCombination]) {
|
||||||
shortcuts.current[keyCombination] = callback;
|
shortcuts.current[keyCombination] = callback;
|
||||||
|
} else if (process.env.NODE_ENV === 'development') {
|
||||||
|
throw new Error(
|
||||||
|
`This shortcut is already present in current scope :- ${keyCombination}`,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('This shortcut is already present in current scope');
|
console.error(
|
||||||
|
`This shortcut is already present in current scope :- ${keyCombination}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[shortcuts],
|
[shortcuts],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user