E57A Execute config watchers · holoviz/panel@7e1c921 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7e1c921

Browse files
committed
Execute config watchers
1 parent 88ef918 commit 7e1c921

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

panel/config.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,21 +332,20 @@ def _set_thread_pool(self):
332332
threads = self.nthreads if self.nthreads else None
333333
state._thread_pool = ThreadPoolExecutor(max_workers=threads)
334334

335-
@param.depends('disconnect_notification', 'notifications', 'ready_notification', watch=True)
335+
@param.depends('notifications', watch=True)
336336
def _enable_notifications(self):
337-
if not any((self.disconnect_notification, self.notifications, self.ready_notification)):
338-
return
339-
elif not self.notifications:
340-
self.notifications = True
341-
return
342-
343337
from .io.notifications import NotificationArea
344338
from .reactive import ReactiveHTMLMetaclass
345339
if self.notifications and 'notifications' not in ReactiveHTMLMetaclass._loaded_extensions:
346340
ReactiveHTMLMetaclass._loaded_extensions.add('notifications')
347341
if not state.curdoc:
348342
state._notification = NotificationArea()
349343

344+
@param.depends('disconnect_notification', 'ready_notification', watch=True)
345+
def _enable_notifications(self):
346+
if self.disconnect_notification or self.ready_notification:
347+
self.notifications = True
348+
350349
@contextmanager
351350
def set(self, **kwargs):
352351
values = [(k, v) for k, v in self.param.values().items() if k != 'name']
@@ -386,8 +385,9 @@ def __setattr__(self, attr, value):
386385
if state.curdoc not in self._session_config:
387386
self._session_config[state.curdoc] = {}
388387
self._session_config[state.curdoc][attr] = value
389-
if attr in self.param:
390-
self.param.trigger(attr)
388+
watchers = self._param_watchers.get(attr, {}).get('value', [])
389+
for w in watchers:
390+
w.fn()
391391
elif f'_{attr}' in self.param and hasattr(self, f'_{attr}_'):
392392
validate_config(self, f'_{attr}', value)
393393
super().__setattr__(f'_{attr}_', value)

0 commit comments

Comments
 (0)
0