Skip to content

Commit 41f738f

Browse files
501981732wangmeng5claude
authored
Fix: update notebook component (#404)
🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: wangmeng5 <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 1451298 commit 41f738f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/react/src/components/notebook/Notebook.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ export const Notebook = (props: INotebookProps) => {
235235
};
236236
// Mutation Effects.
237237
useEffect(() => {
238+
// fix: issue-396 When `serviceManager` changes, the `Notebook` component will recreate the `NotebookAdapter` instance. The old `NotebookAdapter` is not properly disposed, causing shortcut key listener conflicts.
239+
if (adapter) {
240+
adapter.dispose();
241+
setAdapter(undefined);
242+
}
238243
if (serviceManager && serverless) {
239244
createAdapter(serviceManager, kernel);
240245
} else if (serviceManager && kernel) {

0 commit comments

Comments
 (0)