voila icon indicating copy to clipboard operation
voila copied to clipboard

Updating widgets in voila behaves differently than jupyterlab (voila flashes for a few seconds)

Open gioxc88 opened this issue 2 years ago • 2 comments

Very simple app One button, one Table. If you click the button in refreshes the table If you run it Jupyterlab it works fine and the table is updating without flashing If you run it in voila the table gets updated but it disappears for a second before reappearing.

import pandas as pd 
import numpy as np
import ipywidgets as w
from ipydatagrid import DataGrid

def make_grid(rows=20, cols=2):
    
    df = pd.DataFrame(np.random.uniform(size=(rows, cols))).round(2)
    return DataGrid(df)

btn1 = w.Button(description='click me')
cont1 = w.HBox([make_grid()])

def on_click_update1(event):
    grid = make_grid()
    cont1.children[0].data = grid.data
    
btn1.on_click(on_click_update1)
b1 = w.VBox([btn1, cont1])

gioxc88 avatar Nov 06 '22 09:11 gioxc88

Thanks @gioxc88 for reporting the issue. Since ipydatagrid is not working yet with the current main branch of Voila (https://github.com/bloomberg/ipydatagrid/pull/369). I will wait for the update of ipydatagrid before addressing this issue.

trungleduc avatar Nov 08 '22 09:11 trungleduc

@gioxc88, I did not see the versions you are using.

I just tested this on my server with voila = 0.4.0 ipydatagrid =1.1.13

The table updates, on the button press, without any flickering in voila.

Here is a screen recording: click_refresh

afonit avatar Nov 28 '22 18:11 afonit