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

Error when displaying the same chat.ChatFeed multiple times in Panel 1.6.1 #7733

Open
1 task done
s-alexey opened this issue Feb 25, 2025 · 0 comments
Open
1 task done
Milestone

Comments

@s-alexey
Copy link
Contributor

Hi team, thanks for the amazing work you're doing!

I encountered an issue while trying to update to a newer version of Panel. I believe it was introduced by this commit as old_objects may be empty in

not any(isIn(old_objects[i], self.objects) for i in range(*self._last_synced))

ALL software version info

Software Version Info Python==3.11 in [Colab](https://colab.research.google.com/drive/1MV4UtSYRGM4Dx5sGqtCoGVk7vKIMsRDL?usp=sharing), VScode and other Jupyter notebooks
panel==1.6.1
bokeh==3.6.3
jupyter_bokeh==4.0.5

Description of expected behavior and the observed behavior

The chat.ChatFeed should display correctly without errors, even when displayed multiple times.

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn 
from IPython import display

pn.extension()

feed = pn.chat.ChatFeed(objects=[pn.chat.ChatMessage("Hello")])

display.display(feed)
display.display(feed)

Stack traceback and/or browser JavaScript console output

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[/usr/local/lib/python3.11/dist-packages/IPython/core/formatters.py](https://localhost:8080/#) in __call__(self, obj, include, exclude)
    968 
    969             if method is not None:
--> 970                 return method(include=include, exclude=exclude)
    971             return None
    972         else:

11 frames
[/usr/local/lib/python3.11/dist-packages/panel/layout/feed.py](https://localhost:8080/#) in <genexpr>(.0)
    160             self._last_synced and
    161             'visible_range' not in events and
--> 162             not any(isIn(old_objects[i], self.objects) for i in range(*self._last_synced))
    163         ):
    164             with edit_readonly(self):

IndexError: list index out of range
ChatFeed(_placeholder=ChatMessage, sizing_mode='stretch_width')
    [0] ChatMessage(object='Hello', user='User', reactions=[])

Screenshots or screencasts of the bug in action

Here is a notebook

Image Image
  • I may be interested in making a pull request to address this
@philippjfr philippjfr added this to the v1.6.2 milestone Feb 25, 2025
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

No branches or pull requests

2 participants