I'm using dojo.data.ItemFileReadStore to get data from a json source into a dojox.grid.DataGrid. I replace the datastore with DataGrid.setStore(), which works fine, except when I try dto do it before the old datastore has finished loading, which instead causes the DataGrid to crash and being unable to recover. How can I prevent this race condition?