refactor: remove debounce on dice calculations #210

Merged
ptran merged 3 commits from refactor-remove-debounce into main 2025-05-21 09:32:51 +00:00

View file

@ -1,4 +1,4 @@
import { Component, signal, inject, OnInit } from '@angular/core';
import { Component, inject, OnInit, signal } from '@angular/core';
import { CommonModule } from '@angular/common';
import {
FormBuilder,
@ -9,7 +9,7 @@ import {
} from '@angular/forms';
import { DiceService } from './dice.service';
import { DiceDto, DiceResult } from './dice.model';
import { debounceTime, tap } from 'rxjs/operators';
import { tap } from 'rxjs/operators';
import { UserService } from '@service/user.service';
type DiceFormGroup = FormGroup<{
@ -41,10 +41,7 @@ export class DiceComponent implements OnInit {
ngOnInit(): void {
this.diceForm.valueChanges
.pipe(
debounceTime(100),
tap(() => this.calculateWinChanceAndPotentialWin())
)
.pipe(tap(() => this.calculateWinChanceAndPotentialWin()))
.subscribe();
this.calculateWinChanceAndPotentialWin();