Skip to content

Commit a061cef

Browse files
authored
Merge pull request #8 from Styria-Digital/fix_pickle_recursion
Delete json_tag from child components as it could cause RecursionError
2 parents a9e5ab8 + 6a12a37 commit a061cef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

django_unicorn/components/unicorn_template_response.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ def render(self):
247247
for child in descendant.children:
248248
init_script = f"{init_script} {child._init_script}"
249249
json_tags.append(child._json_tag)
250+
# We need to delete this property here as it can cause RecursionError
251+
# when pickling child component. Tag element has previous_sibling
252+
# and next_sibling which would also be pickled and if they are big,
253+
# cause RecursionError
254+
del child._json_tag
250255
descendants.append(child)
251256

252257
script_tag = soup.new_tag("script")

0 commit comments

Comments
 (0)