Skip to content

Commit c7a85d8

Browse files
authored
Fix emitting error object on updateFinishedEvent when remote data request is failed (#106)
The fix is applied to Table and Card generators
1 parent 1acf057 commit c7a85d8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/ng-generate/components/card/generators/components/card/files/__name@dasherize__.component.ts.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ export class <%= classify(name) %>Component implements OnInit, AfterViewInit<% i
219219
this.dataToShow = this.applyAllFilters(this.data);
220220
this.totalItems = this.dataToShow.length;
221221
this.maxExportRows = this.totalItems;
222-
<% } %>
223222

224-
this.cardUpdateFinishedEvent.emit();
223+
this.cardUpdateFinishedEvent.emit();
224+
<% } %>
225225
}
226226

227227
<% if (options.enableRemoteDataHandling) { %>

src/ng-generate/components/shared/methods/remote-handling/requestData.ts.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ private requestData() {
104104
<% } %>
105105

106106
this.dataSource.paginator = this.paginator;
107+
this.<% if (options.componentType === 'card') { %>card<% } else { %>table<% } %>UpdateFinishedEvent.emit();
107108
}),
108109
catchError((error: any) => {
109110
this.dataLoadError = false;
@@ -114,9 +115,10 @@ private requestData() {
114115
const dataToShow = [];
115116
this.dataSource.setData([]);
116117
<% } %>
118+
119+
this.<% if (options.componentType === 'card') { %>card<% } else { %>table<% } %>UpdateFinishedEvent.emit(error);
117120
throw new Error(error.message);
118121
}),
119-
finalize(() => this.<% if (options.componentType === 'card') { %>card<% } else { %>table<% } %>UpdateFinishedEvent.emit()),
120122
takeUntil(this.ngUnsubscribe)
121123
)
122124
.subscribe();

0 commit comments

Comments
 (0)