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

Solve issue : usercard error appears only once (#6104) - release 4.2.0 #6111

Merged

Conversation

freddidierRTE
Copy link
Contributor

This commit resolves an issue where the usercard error would only appear once due to the use of the global flag (/g) in a JavaScript regular expression. The issue was that calling this.EMPTY_REGEXP.test(this.quill.root.innerHTML) on the same string would return true the first time and false subsequently.

The global flag causes the RegExp.test() method to alternate between matching and not matching the regex, as explained in the official MDN documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test#using_test_on_a_regex_with_the_global_flag

- In release note 4.2.0 :

This commit resolves an issue where the usercard error would only appear once due to the use of the global flag (/g) in a JavaScript regular expression.
The issue was that calling this.EMPTY_REGEXP.test(this.quill.root.innerHTML) on the same string would return true the first time and false subsequently.

The global flag causes the RegExp.test() method to alternate between matching and not matching the regex,
as explained in the official MDN documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test#using_test_on_a_regex_with_the_global_flag

Signed-off-by: freddidierRTE <frederic-f.didier@rte-france.com>
Copy link

sonarcloud bot commented Mar 12, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 50%)

See analysis details on SonarCloud

@ClementBouvierN ClementBouvierN merged commit 7768357 into 4.2.0.release Mar 12, 2024
7 of 8 checks passed
@ClementBouvierN ClementBouvierN deleted the FE-6104-bugUserCardErrorOnlyOnce-4.2.release branch March 12, 2024 12:23
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.

None yet

2 participants