ranelpadon / ngram-type

Touch typing trainer using N-grams as data source, with options to customize the auto-generated lessons and specify the minimum typing performance needed. There are sound/color effects as well.
208 stars 40 forks source link

App freezes when setting "combination" value #31

Closed debashisbiswas closed 1 year ago

debashisbiswas commented 1 year ago

Steps to reproduce:

  1. Edit "combination" field directly to change the value to empty or any value less than 1. (this is not possible using the arrow keys, because the browser enforces that the minimum value is 1)
  2. Observe that the application freezes.

After a quick analysis, I can see that the generatePhrases function is getting stuck in an infinite loop unless this value is > 0, but I'm not sure how you'd like to solve this. Maybe stronger validation in the HTML? Let me know and I'd be happy to submit a PR.

ranelpadon commented 1 year ago

Thanks for reporting. This would be a rare case though since 0 combination doesn't make sense and users will not likely use this value. But it's a bug indeed when inputting manually and not using arrow keys.

Feel free to submit a PR, then let's see:

but I'm not sure how you'd like to solve this. Maybe stronger validation in the HTML? Let me know and I'd be happy to submit a PR.

If you could add a validator in the HTML layer it would be great. Otherwise, I think we would add a validator in the Vue layer. :)