reflex icon indicating copy to clipboard operation
reflex copied to clipboard

Data table blinking with the background task

Open narcissu14 opened this issue 2 years ago β€’ 2 comments

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?

narcissu14 avatar Oct 13 '23 08:10 narcissu14

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!

Lendemor avatar Oct 13 '23 08:10 Lendemor

Any updates on this issue?

bldev2473 avatar Aug 24 '25 15:08 bldev2473