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

In usercard error appears only once #6104

Closed
freddidierRTE opened this issue Mar 11, 2024 · 0 comments · Fixed by #6106
Closed

In usercard error appears only once #6104

freddidierRTE opened this issue Mar 11, 2024 · 0 comments · Fixed by #6106
Assignees
Labels
Bug Something isn't working

Comments

@freddidierRTE
Copy link
Contributor

freddidierRTE commented Mar 11, 2024

To reroduce

Go to user card
Click on "See before sending"
An error " You must provide a message" appears
Remove error message
Click on "See before sending"

Nothing happens and exception in console

image

@freddidierRTE freddidierRTE added the Bug Something isn't working label Mar 11, 2024
@freddidierRTE freddidierRTE changed the title Could not send card after an error In usercard error appears only once Mar 11, 2024
freddidierRTE added a commit that referenced this issue Mar 11, 2024
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

This behavior is discussed in this Medium article: https://medium.com/@nikjohn/regex-test-returns-alternating-results-bd9a1ae42cdd

Signed-off-by: freddidierRTE <frederic-f.didier@rte-france.com>
@freddidierRTE freddidierRTE linked a pull request Mar 11, 2024 that will close this issue
freddidierRTE added a commit that referenced this issue Mar 12, 2024
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>
freddidierRTE added a commit that referenced this issue Mar 12, 2024
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>
@freddidierRTE freddidierRTE self-assigned this Mar 12, 2024
ClementBouvierN pushed a commit that referenced this issue Mar 12, 2024
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>
ClementBouvierN pushed a commit that referenced this issue Mar 12, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant