Skip to content

Commit

Permalink
DataSync: fixed useQuery returning [] instead of null when reply is n…
Browse files Browse the repository at this point in the history
…ot available yet
  • Loading branch information
mpscholten committed Nov 18, 2024
1 parent d93f07e commit 8ad0227
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/IHP/DataSync/ihp-datasync.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,17 @@ class DataSubscription {
this.connectError = null;
this.subscriptionId = null;
this.subscribers = [];
this.records = cache ? cache.get(JSON.stringify(query)) || [] : [];

if (cache) {
const cacheResults = cache.get(JSON.stringify(query));
if (cacheResults !== undefined) {
this.records = cacheResults;
} else {
this.records = null;
}
} else {
this.records = null;
}
this.cache = cache;

this.getRecords = this.getRecords.bind(this);
Expand Down

0 comments on commit 8ad0227

Please sign in to comment.