-
Notifications
You must be signed in to change notification settings - Fork 92
gppa-populate-child-entries.php: Fixed field does not populate on first load issue.
#1090
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
Conversation
WalkthroughThe update modifies the Changes
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
gp-populate-anything/gppa-populate-child-entries.php (1)
135-141: Great fix for the cookie null check.The added condition
&& gpnfCookieensures that the code won't attempt to access thehashproperty of a potentially undefined or null cookie object. This defensive programming approach prevents JavaScript errors during initial page load when the cookie might not be available yet, fixing the issue where the field doesn't populate on first load.For even more robust error handling, you could consider:
- if ( ! self.$peidField.val() && gpnfCookie ) { + if ( ! self.$peidField.val() && gpnfCookie && typeof gpnfCookie.hash !== 'undefined' ) {This additional check ensures the
hashproperty exists before attempting to use it, though your current fix should handle the reported issue completely.
saifsultanc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to fully work as desired.
I made a loom explaining:
https://www.loom.com/share/f99ef6460860410691832455d7037475
Lmk!
dc42dd7 to
153d47d
Compare
…irst load issue.
153d47d to
7bce51b
Compare
saifsultanc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. LGTM!
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2917938488/82554
Summary
Due to some JS error in console, field doesn't populate on first load. If we reload the page, it populates.
Here's the loom recording of this issue. This PR fixes this issue.
https://www.loom.com/share/7fc577ae7c274ec48df5a1b3c36fe995?sid=26c1e9f0-ec10-473e-b6e7-bad4622b9ed8