Skip to content

Commit 3f79e77

Browse files
Update caching logic for tables (#329)
1 parent f809ad2 commit 3f79e77

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/table.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,10 @@ function sourceCache(loadSource) {
177177
return (source, name) => {
178178
if (!source) throw new Error("data source not found");
179179
let promise = cache.get(source);
180-
if (!promise) {
180+
if (!promise || (isDataArray(source) && source.length !== promise._numRows)) {
181181
// Warning: do not await here! We need to populate the cache synchronously.
182182
promise = loadSource(source, name);
183+
promise._numRows = source.length; // This will be undefined for DatabaseClients
183184
cache.set(source, promise);
184185
}
185186
return promise;

0 commit comments

Comments
 (0)