Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(uiGrid): Fix race condition in data watcher
The data watch function is creating a condition where promises can get resolved out of order. If you are fetching both cell templates and data over the network, it will operate thusly: 1. Data watch fires with empty data array, it sees there's no columns set up and builds them from the columnDefs. This uses a promise from the preCompileCellTemplates function. 2. The new data comes in, the data watcher sees there's columns set up now so nothing has to be done and it sets the rows to your new data. Yay! 3. The promise from preCompileCellTemplates completes, and the data is updated AGAIN, but this time with the original empty data set, blowing away the data you fetched. This fix changes the operation so we only call buildColumnDefsFromData() when we actually HAVE data to use, and buildColumns() gets called if we either have data OR have columnDefs. Fixes #2053
- Loading branch information