Skip to content

Commit 6e2e2dc

Browse files
committed
fix: manually invoke display_preview_on_jupyter
1 parent 3400733 commit 6e2e2dc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pygwalker/api/pygwalker.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def display_preview_on_jupyter(self):
258258
"""
259259
Display preview on jupyter notebook/lab.
260260
"""
261-
display_html(self._get_gw_preview_html())
261+
display_html(self._get_gw_preview_html(True))
262262

263263
@property
264264
def chart_list(self) -> List[str]:
@@ -581,7 +581,10 @@ def _get_render_iframe(
581581
else:
582582
return html
583583

584-
def _get_gw_preview_html(self) -> str:
584+
def _get_gw_preview_html(self, manual: bool = False) -> str:
585+
"""
586+
'manual' represents the user actively calling to obtain preview_html. It will randomly generate a gid, keeping it separate from the logic of walker automatically generating the preview part.
587+
"""
585588
if not self.workflow_list:
586589
return ""
587590
datas = []
@@ -594,7 +597,7 @@ def _get_gw_preview_html(self) -> str:
594597
self.vis_spec,
595598
datas,
596599
self.theme_key,
597-
self.gid,
600+
self.gid if not manual else self.gid + rand_str(),
598601
self.appearance
599602
)
600603

0 commit comments

Comments
 (0)