Merge pull request 'refactor: remove debounce on dice calculations' (!210) from refactor-remove-debounce into main
All checks were successful
Release / Release (push) Successful in 1m0s
Release / Build Backend Image (push) Successful in 24s
Release / Build Frontend Image (push) Successful in 29s

Reviewed-on: #210
Reviewed-by: Jan K9f <jan@kjan.email>
This commit is contained in:
Phan Huy Tran 2025-05-21 09:32:50 +00:00
commit c9632d6b26
No known key found for this signature in database
GPG key ID: 944223E4D46B7412

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