Skip to content
Open
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
4 changes: 2 additions & 2 deletions panel/io/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ def onload(self, callback: Callable[[], None | Coroutine[Any, Any, None]], threa
else:
self._onload[self.curdoc] = [(callback, threaded)]

def on_session_created(self, callback: Callable[[SessionContext], None]) -> None:
def on_session_created(self, callback: Callable[[BokehSessionContext], None]) -> None:
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The type annotation change to BokehSessionContext is inconsistent with the class variable _on_session_created at line 187, which is typed as list[Callable[[SessionContext], None]]. This creates a type incompatibility when appending callbacks at line 796. Additionally, internal callbacks like _initialize_session_info (line 167 in server.py) and _register_session_destroyed (line 501) use SessionContext, not BokehSessionContext.

The class variables at lines 187-189 should also be updated to use BokehSessionContext for consistency, or if SessionContext is the correct type, then this change should be reverted.

Suggested change
def on_session_created(self, callback: Callable[[BokehSessionContext], None]) -> None:
def on_session_created(self, callback: Callable[[SessionContext], None]) -> None:

Copilot uses AI. Check for mistakes.
"""
Callback that is triggered when a session is created.
"""
Expand All @@ -795,7 +795,7 @@ def on_session_created(self, callback: Callable[[SessionContext], None]) -> None
)
self._on_session_created.append(callback)

def on_session_destroyed(self, callback: Callable[[SessionContext], None]) -> None:
def on_session_destroyed(self, callback: Callable[[BokehSessionContext], None]) -> None:
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The type annotation change to BokehSessionContext is inconsistent with the class variable _on_session_destroyed at line 189, which is typed as list[Callable[[SessionContext], None]]. This creates a type incompatibility when appending callbacks at line 808. Additionally, Bokeh's Document.on_session_destroyed method (called at line 804) expects Callable[[SessionContext], None], not BokehSessionContext.

The class variable at line 189 should also be updated to use BokehSessionContext for consistency, or if SessionContext is the correct type, then this change should be reverted.

Suggested change
def on_session_destroyed(self, callback: Callable[[BokehSessionContext], None]) -> None:
def on_session_destroyed(self, callback: Callable[[SessionContext], None]) -> None:

Copilot uses AI. Check for mistakes.
"""
Callback that is triggered when a session is destroyed.
"""
Expand Down
Loading