Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(QInput): use-mask does not respect input debounce #17582

Closed
wants to merge 1 commit into from

Conversation

Dtsiantaris
Copy link
Contributor

Resolves #17568

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Documentation
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the dev branch (or v[X] branch)
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)
  • It's been tested on a Cordova (iOS, Android) app
  • It's been tested on an Electron app
  • Any necessary documentation has been added or updated in the docs or explained in the PR's description.

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to start a new feature discussion first and wait for approval before working on it)

Other information:
QInput when used with a mask basically emits the value through the use-mask composable.

This composable did not take into account the possible debounce for props.modelValue before checking if it should emit. Which led to the issue linked here.

So this PR makes use-mask wait before evaluating if it should emit. All other mask-related operations do not wait so the mask functionalities do not break in the process.

Copy link

UI Tests Results

    1 files     98 suites   38s ⏱️
1 031 tests 1 031 ✅ 0 💤 0 ❌
1 050 runs  1 050 ✅ 0 💤 0 ❌

Results for commit 913716c.

@rstoenescu
Copy link
Member

Hi,

Thanks for contributing!
However, the emitValue() function already takes the debounce into account, so not sure why another timeout is necessary. Also, the composable import should be targeted with the actual file instead of referencing all the composables (as it will break tree-shaking).

@rstoenescu rstoenescu closed this Oct 18, 2024
@Dtsiantaris
Copy link
Contributor Author

Dtsiantaris commented Oct 19, 2024

Hey @rstoenescu,

My bad about the import.
As for the useMask composable, you are right that emitValue() does take debounce into account.

But the composable itself is not.

image

This is the only place inside the useMask that emitValue is used.

By the time this if statement takes place, the modelValue has not yet been able to update if a debounce is present and the input of the user is fast enough.
emitValue is never called before it as updateMaskValue is used instead when a mask is present.

EDIT: I'm adding part of the onInput function that calls the updateMaskValue with no timeouts.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Q-Input with both mask and debounce causes ctrl+v to not store in the model when the model is already filled
2 participants