Skip to content

Commit 914a4d5

Browse files
tisfengclaude
andcommitted
refactor(shortcut): remove redundant updateNSView implementation
This commit removes the unnecessary updateNSView implementation from KeyHolderWrapper. The removed code was restoring key combos whenever the view was updated, but this functionality is already properly handled in makeNSView. Since KeyHolderWrapper doesn't have any state properties that would trigger view updates, the updateNSView method was performing redundant work without any practical benefit. This change improves performance by eliminating unnecessary key combo restoration calls and makes the code cleaner and more maintainable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fb7adf6 commit 914a4d5

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Easydict/Swift/Feature/Shortcut/View/KeyHolderWrapper.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ struct KeyHolderWrapper: NSViewRepresentable {
4242
return recordView
4343
}
4444

45-
func updateNSView(_ nsView: NSViewType, context: Context) {
46-
// Restore the key combo when the view is updated (e.g., when switching tabs)
47-
if let recordView = nsView as? RecordView {
48-
context.coordinator.restoreKeyCombo(recordView)
49-
}
50-
}
45+
func updateNSView(_ nsView: NSViewType, context: Context) {}
5146

5247
// MARK: Private
5348

0 commit comments

Comments
 (0)