@@ -44,7 +44,7 @@ def changes_detected(self, last_update_id: UpdateID) -> bool:
4444 @staticmethod
4545 @abstractmethod
4646 def render_item (item : Any ) -> AnyComponent :
47- """return a rendered component to display """
47+ """returns a `fastui. component` to which renders the content of the item """
4848
4949 def get_messages (self ) -> tuple [UpdateID , list [AnyComponent ]]:
5050 return self ._get_update_id (), [self .render_item (x ) for x in self ._items ]
@@ -93,17 +93,25 @@ async def render_items_on_change(
9393 app : FastAPI ,
9494 * ,
9595 renderer_type : type [AbstractSSERenderer ],
96- messages_check_interval : NonNegativeFloat = 1 ,
96+ check_interval : NonNegativeFloat = 1 ,
9797) -> AsyncIterable [str ]:
98- """used by the sse endpoint to render the content as it changes"""
98+ """Used by an SSE endpoint to provide updates for a specific renderer.
99+ Only sends out new updates if the underlying dataset canged.
100+
101+ Arguments:
102+ renderer_type -- the class rendering an item to be displayed, must be defined by the user
103+
104+ Keyword Arguments:
105+ check_interval -- interval at which to check for new updates (default: {1})
106+ """
99107
100108 async with renderer_type (app ) as renderer :
101109
102110 last_update_id , messages = renderer .get_messages ()
103111
104112 # Avoid the browser reconnecting
105113 while True :
106- await asyncio .sleep (messages_check_interval )
114+ await asyncio .sleep (check_interval )
107115
108116 update_id , messages = renderer .get_messages ()
109117
0 commit comments