quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.74k stars 3.5k forks source link

Lazy Rules Stays Lazy After First Blur #17456

Open xarmin-dev opened 3 weeks ago

xarmin-dev commented 3 weeks ago

What happened?

When a QInput is configured with :lazy-rules=true, validation does not occur until the first blur, as expected. After the first blur, validation only occurs on subsequent blurs, and does not occur as changes are made to the model.

What did you expect to happen?

As stated in the documentation:

lazy-rules: If set to boolean true then it checks validation status against the 'rules' only after field loses focus for first time.

Validation should occur on the first blur. After the first blur, validation should occur with changes to the model.

Reproduction URL

https://codepen.io/xarmin/pen/vYqjJav?editors=101

How to reproduce?

  1. Enter text into the input.
  2. Blur the input.
  3. Make changes to the input to fulfill validation requirements.
  4. Observe that validation does not update.

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Components (quasar)

Platforms/Browsers

Firefox

Quasar info output

No response

Relevant log output

No response

Additional context

This behavior also occurs on the Quasar documentation site for QInput: https://quasar.dev/vue-components/input#example--lazy-rules

I believe this behavior changed at some point, based on past projects and various GitHub conversations I have found. This change does not seem intentional.

yusufkandemir commented 3 weeks ago

Yes, it was changed in https://github.com/quasarframework/quasar/commit/5c9a57964acbaba062f69365e5e6ddbd486e0c37, 8 months ago. It was an intentional change, but that doesn't mean we are happy with the result. We will introduce a new lazy-rules mode, e.g. lazy-rules="eager" to get the old result. You would be surprised to hear that the new weird behavior has a use case in the real world. In my opinion, a new type of option should've been added to support the "weird" behavior instead of updating the existing behavior, but this is what we can do now.

xarmin-dev commented 3 weeks ago

Well, there you go! It seems I need to pay closer attention to the change logs...

I agree that it would have been better to add an option for the "weird" behavior, instead of changing what had already been established (and seemed to make sense). But, that might just be my stubbornness talking.

Thanks for the reply! I will find a workaround for now. Looking forward to the new mode.