Panel notifications has issues on the first notification

Hi,

In Jupyter Lab (version 4.0.9), I am trying to use panel notifications, like:

import panel as pn

pn.extension(notifications=True)
pn.state.notifications.error('test')

The strange thing is that on the first time, the notification does not appear, but every time afterwards, the notification does appear :thinking:.

I produced this issue using the official docker image (quay.io/jupyter/minimal-notebook) and installed panel (1.3.6) via pip.

Additionally, here is some system context:

IPython          : 8.18.1
ipykernel        : 6.26.0
ipywidgets       : not installed
jupyter_client   : 8.6.0
jupyter_core     : 5.5.0
jupyter_server   : 2.12.1
jupyterlab       : 4.0.9
nbclient         : 0.8.0
nbconvert        : 7.12.0
nbformat         : 5.9.2
notebook         : 7.0.6
qtconsole        : not installed
traitlets        : 5.14.0

Any thoughts on whether I am missing something or whether this is a panel issue?

Found the issue myself by debugging cell execution twice.

During the first execution of pn.extension() and the second execution I found a difference: It appeared that panel_extension._display_globals in panel.config is not called the first time but only the second time.

For testing, I changed the code to forcefully call panel_extension._display_globals() during the first time, which resolved the issue.

1 Like

Hi @boekm

Please consider filing this as a bug if you believe it is. Will help the next user.

Done. See: Notification initialisation is not properly working · Issue #6178 · holoviz/panel · GitHub