Skip to content

Commit f6a13d3

Browse files
authored
API for returning extra items returned by render server
1 parent 5631e2b commit f6a13d3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

react/render_server.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99

1010
class RenderedComponent(object):
11-
def __init__(self, markup, props):
11+
def __init__(self, markup, props, extra):
1212
self.markup = markup
1313
self.props = props
14+
self.extra = extra
1415

1516
def __str__(self):
1617
return self.markup
@@ -67,8 +68,9 @@ def render(self, path, props=None, to_static_markup=False, request_headers=None,
6768

6869
obj = res.json()
6970

70-
markup = obj.get('markup', None)
71-
err = obj.get('error', None)
71+
markup = obj.pop('markup', None)
72+
err = obj.pop('error', None)
73+
extra = obj
7274

7375
if err:
7476
if 'message' in err and 'stack' in err:
@@ -80,7 +82,7 @@ def render(self, path, props=None, to_static_markup=False, request_headers=None,
8082
if markup is None:
8183
raise ReactRenderingError('Render server failed to return markup. Returned: {}'.format(obj))
8284

83-
return RenderedComponent(markup, serialized_props)
85+
return RenderedComponent(markup, serialized_props, extra)
8486

8587

8688
render_server = RenderServer()

0 commit comments

Comments
 (0)