Grid is not refresh data when I call refreshAll and refreshitems when I hav

Can someone help me and let me know if the Grid RefreshAll is working?

I am using Vaadin-Spring-Boot-Starter 2.0.1, Vaadin 8.0.5 and Firebase-admin 4.1.7

I have to add an update button in order to get the update data from the serve at first time, after the data is updated into the grid. The next time if I add a new data, it works on ListDataProvider.refreshAll.

The ListDataProvider is not working to update data in the grid when the page is loaded, I saw on the other post suggest using push.

Is it correct to use push and get the grid updated or it just a simple bug in the dataprovider?

Here is my code

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.data.provider.ListDataProvider;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Grid;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickEvent;

@SpringUI
public class MyUI extends UI implements ChildEventListener{

@Autowired
FirebaseConnector firebaseConnector;

ListDataProvider wineDataProvider;
List wines = new ArrayList<>();
Grid wineGrid = new Grid<>();

private TextField wineNameField;

private TextField vintageField;

private TextField priceField;

@Override
protected void init(VaadinRequest request) {

wineGrid.addColumn(Wine::getName).setCaption(“Wine Name”);
wineGrid.addColumn(Wine::getVintage).setCaption(“Vintage”);
wineGrid.addColumn(Wine::getPrice).setCaption(“Price”);
wineDataProvider = DataProvider.ofCollection(wines);
wineGrid.setDataProvider(wineDataProvider);

DatabaseReference wine_list_ref = firebaseConnector.getFirebaseDatabase().getReference().child(“wine_list”);

wineNameField = new TextField();
vintageField = new TextField();
priceField = new TextField();

Button updateButton = new Button(“Update Wine List”);

updateButton.addClickListener(new ClickListener() {

@Override
public void buttonClick(ClickEvent event) {
wineDataProvider.refreshAll();
}
});

Wine wine = new Wine();

Button button = new Button(“Save Wine”);

button.addClickListener(e->{
wine.setName(wineNameField.getValue());
wine.setVintage(vintageField.getValue());
wine.setPrice(Double.valueOf(priceField.getValue()));
if(wine.getName()!=null) {
DatabaseReference wineRef=wine_list_ref.push();
wineRef.setValue(wine);
wineDataProvider.refreshAll();
}

});

wine_list_ref.addChildEventListener(this);

VerticalLayout v1 = new VerticalLayout();
v1.addComponents(wineNameField,vintageField,priceField,button,updateButton,wineGrid);

setContent(v1);
}

@Override
public void onChildAdded(DataSnapshot arg0, String arg1) {

Wine wine = arg0.getValue(Wine.class);
wine.setKey(arg0.getKey());
wines.add(wine);

wineDataProvider.refreshAll();
}

@Override
public void onChildChanged(DataSnapshot arg0, String arg1) {

}

@Override
public void onChildMoved(DataSnapshot arg0, String arg1) {
// TODO Auto-generated method stub

}

@Override
public void onChildRemoved(DataSnapshot arg0) {
// TODO Auto-generated method stub

Wine wine = new Wine();
wine.setKey(arg0.getKey());
wineDataProvider.getItems().remove(wine);
wineDataProvider.refreshAll();

}

@Override
public void onCancelled(DatabaseError arg0) {
// TODO Auto-generated method stub

}

}

Found out need to enable Server push