Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Fixed the issue that switch tab twince #1624

Merged
merged 1 commit into from
Jan 14, 2025
Merged

Conversation

fit2bot
Copy link
Contributor

@fit2bot fit2bot commented Jan 14, 2025

Fixed: Fixed the issue that switch tab twince

@fit2bot fit2bot requested a review from a team January 14, 2025 08:34
} else {
mittBus.emit('alt-shift-right');
}

break;
case 'ArrowLeft':
if (lunaId && origin) {
sendEventToLuna('KEYEVENT', 'alt+shift+left', lunaId, origin);
debouncedSwitchTab(lunaId, origin, 'ArrowLeft');
} else {
mittBus.emit('alt-shift-left');
}
Copy link
Member

Choose a reason for hiding this comment

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

There are several issues in this code related to the handling of custom keys:

  1. The debouncedSwitchTab function is used without being defined before it uses this context.

  2. The variable name "origin" in both cases should be consistent and not change between methods.

  3. There's no logic implemented in the event handler that sends messages to Luna UI based on user actions like arrow movements.

  4. In terms of optimizations, using TypeScript or static type checking could help catch logical mistakes at compile time.

  5. It would also benefit to add error checks inside functions to ensure things don't blow up (for instance, by sending events with invalid arguments).

  6. Consider reorganizing these pieces into a more reusable way so they can apply to different contexts rather than repeating logic within every method.

@ZhaoJiSen ZhaoJiSen merged commit ca0c76f into dev Jan 14, 2025
6 of 7 checks passed
@ZhaoJiSen ZhaoJiSen deleted the pr@dev@fixed_switch_tab branch January 14, 2025 08:34
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.

3 participants