Skip to content

Commit 67945f2

Browse files
authored
Merge pull request #45 from ctrl-hub/fix-hydration-issue
fix hydration issue
2 parents 5bffc3f + fda0fa5 commit 67945f2

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

dist/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,8 @@ class Hydrator {
12441244
return this.modelMap;
12451245
};
12461246
hydrateResponse(data, included) {
1247+
if (!data)
1248+
return data;
12471249
return Array.isArray(data) ? this.hydrateArray(data, included) : this.hydrateSingle(data, included);
12481250
}
12491251
hydrateArray(items, included) {

dist/utils/Hydrator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ export class Hydrator {
7373
return this.modelMap;
7474
};
7575
hydrateResponse(data, included) {
76+
if (!data)
77+
return data;
7678
return Array.isArray(data) ? this.hydrateArray(data, included) : this.hydrateSingle(data, included);
7779
}
7880
hydrateArray(items, included) {

src/utils/Hydrator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class Hydrator {
7979
};
8080

8181
hydrateResponse<T extends Model>(data: JsonData | JsonData[], included: any[]): T | T[] {
82+
if (!data) return data;
8283
return Array.isArray(data) ? this.hydrateArray<T>(data, included) : this.hydrateSingle<T>(data, included);
8384
}
8485

0 commit comments

Comments
 (0)