File tree Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,10 @@ Unreleased
2626
2727**Added **
2828
29- - :pull: `1165 ` - Allow concurrent renders of  discrete component tree  - enable this
30-   experimental feature by setting `REACTPY_ASYNC_RENDERING=true `. This should improve 
31-   the overall responsiveness of your app, particularly when handling  larger renders
32-   that would  otherwise block faster  renders from being processed .
29+ - :pull: `1165 ` - Allow concurrently rendering  discrete component trees  - enable this
30+   experimental feature by setting `REACTPY_ASYNC_RENDERING=true `. This improves 
31+   the overall responsiveness of your app in situations where  larger renders would 
32+   otherwise block smaller  renders from executing .
3333
3434**Changed **
3535
Original file line number Diff line number Diff line change @@ -82,9 +82,9 @@ def boolean(value: str | bool | int) -> bool:
8282"""A default timeout for testing utilities in ReactPy""" 
8383
8484REACTPY_ASYNC_RENDERING  =  Option (
85-     "REACTPY_CONCURRENT_RENDERING " ,
85+     "REACTPY_ASYNC_RENDERING " ,
8686    default = False ,
8787    mutable = True ,
8888    validator = boolean ,
8989)
90- """Whether to render components concurrently . This is currently an experimental feature.""" 
90+ """Whether to render components asynchronously . This is currently an experimental feature.""" 
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ async def deliver(self, event: LayoutEventMessage) -> None:
129129
130130    async  def  render (self ) ->  LayoutUpdateMessage :
131131        if  REACTPY_ASYNC_RENDERING .current :
132-             return  await  self ._concurrent_render ()
132+             return  await  self ._parallel_render ()
133133        else :  # nocov 
134134            return  await  self ._serial_render ()
135135
@@ -147,8 +147,10 @@ async def _serial_render(self) -> LayoutUpdateMessage:  # nocov
147147            else :
148148                return  await  self ._create_layout_update (model_state )
149149
150-     async  def  _concurrent_render (self ) ->  LayoutUpdateMessage :
151-         """Await the next available render. This will block until a component is updated""" 
150+     async  def  _parallel_render (self ) ->  LayoutUpdateMessage :
151+         """Await to fetch the first completed render within our asyncio task group. 
152+         We use the `asyncio.tasks.wait` API in order to return the first completed task. 
153+         """ 
152154        await  self ._render_tasks_ready .acquire ()
153155        done , _  =  await  wait (self ._render_tasks , return_when = FIRST_COMPLETED )
154156        update_task : Task [LayoutUpdateMessage ] =  done .pop ()
Original file line number Diff line number Diff line change 3232
3333
3434@pytest .fixture (autouse = True , params = [True , False ]) 
35- def  concurrent_rendering (request ):
35+ def  async_rendering (request ):
3636    with  patch .object (REACTPY_ASYNC_RENDERING , "current" , request .param ):
3737        yield  request .param 
3838
@@ -1252,9 +1252,9 @@ def App():
12521252        assert  c ["attributes" ]["color" ] ==  "blue" 
12531253
12541254
1255- async  def  test_concurrent_renders ( concurrent_rendering ):
1256-     if  not  concurrent_rendering :
1257-         raise  pytest .skip ("Concurrent  rendering not enabled" )
1255+ async  def  test_async_renders ( async_rendering ):
1256+     if  not  async_rendering :
1257+         raise  pytest .skip ("Async  rendering not enabled" )
12581258
12591259    child_1_hook  =  HookCatcher ()
12601260    child_2_hook  =  HookCatcher ()
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments