Skip to content

Commit 5522037

Browse files
Read global element variable at creation time of the promise,… (#1566)
* Read global element variable at creation time of the promise, not during resolve. At resolve time, the global variable might already have changed. * Restore original formatting to be able to track what was changed --------- Co-authored-by: AU <[email protected]>
1 parent 3837cc5 commit 5522037

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cadquery/occ_impl/jupyter_tools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@
131131
TEMPLATE_RENDER
132132
+ """
133133
134+
function load_and_render(parent_element)
135+
{{
134136
new Promise(
135137
function(resolve, reject)
136138
{{
@@ -148,10 +150,12 @@
148150
}} else {{ resolve() }};
149151
}}
150152
).then(() => {{
151-
var parent_element = {element};
152153
var data = {data};
153154
render(data, parent_element, {ratio});
154155
}});
156+
}}
157+
158+
load_and_render({element});
155159
"""
156160
)
157161

0 commit comments

Comments
 (0)