reflex
reflex copied to clipboard
Data table blinking with the background task
Describe the bug The data table blinks with the background task.(Tested by change the sleep time)
Environment
- Python version: 3.9.0
- Reflex version: 0.2.9
- Browser: Chrome 117.0.5938.150
Code
class State(rx.State):
now: str = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
data: list = []
query_limit = 10
def query_limit_set(self, value):
self.query_limit = value
def get_data(self):
self.data = sql.get_all(int(self.query_limit))
def update_now(self):
self.now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@rx.background
async def timed_update(self):
while True:
async with self:
self.update_now()
await asyncio.sleep(2)
Is there anything I missed?
This might be due to how this data table is redrawn. We are working on a new datatable (and other improvements) that should help with that issue, stay tuned!
Any updates on this issue?