Skip to content

quality-debt: assets/js/checkout.js — PR #913 review feedback (medium) #915

@superdav42

Description

@superdav42

Unactioned Review Feedback

Source PR: #913
File: assets/js/checkout.js
Reviewers: coderabbit
Findings: 1
Max severity: medium


MEDIUM: coderabbit (coderabbitai[bot])

File: assets/js/checkout.js:1233
⚠️ Potential issue | 🟠 Major

Emit the failure hook when pre-submit work rejects.

This failure path sets login_error but skips wu_inline_login_error, so addons that reset captcha/widgets on login failure will not run for rejected wu_before_inline_login_submitted promises. The nested prompt path already routes this through handleError.

Proposed fix
 	} catch (err) {
 
 		this.logging_in = false;
-		this.login_error = (err && err.message) ? err.message : (wu_checkout.i18n.login_failed || 'Login failed. Please try again.');
+		this.login_error = (err && err.message) ? err.message : (wu_checkout.i18n.login_failed || 'Login failed. Please try again.');
+		hooks.doAction('wu_inline_login_error', {
+			data: {
+				message: this.login_error,
+			},
+			originalError: err,
+		}, field_type);
 		return false;
 
 	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@assets/js/checkout.js` around lines 1224 - 1233, When the Promise.all of
hooks.applyFilters('wu_before_inline_login_submitted', [], field_type) rejects
the catch block currently sets this.logging_in and this.login_error but does not
emit the failure hook; call the same failure handler used by the nested prompt
path (emit the 'wu_inline_login_error' hook or invoke the existing handleError
path) with the error and field_type so addons can reset captcha/widgets, then
preserve the existing this.logging_in=false and return false behavior. Ensure
you reference the rejection from
hooks.applyFilters('wu_before_inline_login_submitted', [], field_type) and emit
'wu_inline_login_error' (or call handleError) with err and field_type before
returning.

View comment



Auto-generated by quality-feedback-helper.sh scan-merged. Review each finding and either fix the code or dismiss with a reason.


aidevops.sh v3.8.95 automated scan.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions