File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -243,11 +243,29 @@ async def get_client_data(
243243 'filtered_sorted' : 'forEachNodeAfterFilterAndSort' ,
244244 'leaf' : 'forEachLeafNode' ,
245245 }
246- result = await self . client . run_javascript ( f'''
246+ js_code = f'''
247247 const rowData = [];
248248 getElement({ self .id } ).api.{ API_METHODS [method ]} (node => rowData.push(node.data));
249249 return rowData;
250+ '''
251+ result = await self .client .run_javascript (f'''
252+ try {{
253+ { js_code }
254+ }} catch (e) {{
255+ return null;
256+ }}
250257 ''' , timeout = timeout )
258+ if result is not None :
259+ return cast (list [dict ], result )
260+ # getElement failed, move the element to make it accessible
261+ past_parent = next (self .ancestors ())
262+ past_index_in_parent = list (past_parent .descendants ()).index (self )
263+ past_visible = self .visible
264+ self .move (self .client .content )
265+ self .visible = False
266+ result = await self .client .run_javascript (js_code , timeout = timeout )
267+ self .move (past_parent , target_index = past_index_in_parent )
268+ self .visible = past_visible
251269 return cast (list [dict ], result )
252270
253271 async def load_client_data (self ) -> None :
Original file line number Diff line number Diff line change @@ -409,7 +409,7 @@ function createApp(elements, options) {
409409
410410 await this . $nextTick ( ) ;
411411 for ( const [ id , element ] of Object . entries ( msg ) ) {
412- if ( element ?. update_method ) {
412+ if ( element ?. update_method && getElement ( id ) ) {
413413 getElement ( id ) [ element . update_method ] ( ) ;
414414 }
415415 }
You can’t perform that action at this time.
0 commit comments