Przeglądaj źródła

fix plot on auto-index page #124

Falko Schindler 2 lat temu
rodzic
commit
35792153ed
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      nicegui/elements/plot.py

+ 3 - 1
nicegui/elements/plot.py

@@ -22,7 +22,9 @@ class Plot(Element):
         self.close = close
         self.close = close
         self.fig = plt.figure(**kwargs)
         self.fig = plt.figure(**kwargs)
         self._convert_to_html()
         self._convert_to_html()
-        create_task(self._auto_close(), name='auto-close plot figure')
+
+        if not self.client.shared:
+            create_task(self._auto_close(), name='auto-close plot figure')
 
 
     def _convert_to_html(self) -> None:
     def _convert_to_html(self) -> None:
         with io.StringIO() as output:
         with io.StringIO() as output: