Skip to content

Commit

Permalink
GH-278 Remove subject
Browse files Browse the repository at this point in the history
We actually want to debounce the network request,
not updating the model.
  • Loading branch information
Zemke committed Jan 22, 2022
1 parent 6dcf2ea commit e54f1cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
3 changes: 1 addition & 2 deletions cwt-angular/src/main/webapp/app/message/chat.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
<form>
<div class="input-group input-group chat-input">
<input type="text" name="chat-input" class="single-line form-control"
[ngModel]="chatInputValue"
(ngModelChange)="chatInputChange.next($event)"
(keydown)="onKeydown($event)"
(keyup)="onKeyup($event)"
(input)="onInput($event)"
id="chat-input">
<span class="input-group-append">
<button class="btn btn-primary submit" type="button">
Expand Down
11 changes: 1 addition & 10 deletions cwt-angular/src/main/webapp/app/message/chat.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {Component, Inject, Input, OnDestroy, OnInit} from '@angular/core';
import {RequestService} from "../_services/request.service";
import {Subject} from 'rxjs';
import {debounceTime, distinctUntilChanged, map} from 'rxjs/operators';
import {JwtUser, Message, MessageCategory, MessageCreationDto, MessageDto, UserMinimaDto} from "../custom";
import {AuthService} from "../_services/auth.service";
import {Toastr} from "../_services/toastr";
Expand All @@ -21,8 +19,6 @@ export class ChatComponent implements OnInit, OnDestroy {
authUser: JwtUser;
suggestions: UserMinimalDto[]? = null;
recipients: UserMinimalDto[] = [];
chatInputValue = "";
chatInputChange = new Subject<string>();
private allSuggestions: UserMinimalDto[] = [];
private readonly messagesSize = 30;
private oldestMessage: number;
Expand All @@ -35,11 +31,6 @@ export class ChatComponent implements OnInit, OnDestroy {
private authService: AuthService,
private toastr: Toastr,
@Inject(APP_CONFIG) private appConfig: AppConfig) {
this.chatInputChange.pipe(debounceTime(200), distinctUntilChanged())
.subscribe(v => {
this.chatInputValue = v;
this.onInput();
});

}

Expand Down Expand Up @@ -207,7 +198,6 @@ export class ChatComponent implements OnInit, OnDestroy {
this.suggestions = res.slice(0, 5);
});
}

}

/**
Expand Down Expand Up @@ -298,3 +288,4 @@ ${message.author.username}: ${message.body}`;
: this.toastr.info('There are no more messages.'));
}
}

0 comments on commit e54f1cf

Please sign in to comment.