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

hotfix: active chat view if openNewChat function not exists in chat view #84

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,14 @@ export default class SmartCopilotPlugin extends Plugin {
} else {
const chatView = this.app.workspace.getLeavesOfType(CHAT_VIEW_TYPE)[0]
.view as ChatView
chatView.openNewChat(selectedBlock ?? undefined)
if ('openNewChat' in chatView) {
chatView.openNewChat(selectedBlock ?? undefined)
} else {
// Fallback to activating a new chat view if openNewChat isn't available (sometimes happens)
await this.activateChatView({
selectedBlock: selectedBlock ?? undefined,
})
}
}
}

Expand Down
Loading