Skip to content

Conversation

@raja2576
Copy link

Summary

This PR fixes two issues in the writers-program frontend JavaScript code:

  1. PhotoSwipe Gallery Bug: Added a guard clause to safely handle cases where data-size is missing from thumbnail links. This prevents .split() from throwing runtime errors.
  2. Mailchimp Integration: Replaced incorrect post URL with the proper post-json format required for Mailchimp’s AJAX submission to work correctly.

Changes Made

  • Modified clPhotoswipe function to skip items with undefined data-size
  • Updated the mailChimpURL in the config to use post-json?...&c=?
  • Minor code clean-up and safe DOM access

Why This is Important

  • Fixes a JavaScript crash that occurs when data-size is not defined on a gallery item
  • Restores working Mailchimp newsletter form for users subscribing via the frontend

Testing

  • Manually tested the gallery: no errors in console when clicking thumbnails
  • Mailchimp form submits successfully with a valid email
  • No regressions observed in animations or scrolling

Type of Contribution

  • Bug fix 🐛
  • Code enhancement 🔧

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you and congratulations 🎉 for opening your very first pull request in writers-program

Signed-off-by: raja2576 <[email protected]>
@raja2576 raja2576 force-pushed the fix/photoswipe-mailchimp-raja_kr_rana_raja2576 branch from b277893 to 85f35c2 Compare June 18, 2025 16:17
@raja2576 raja2576 closed this Jun 18, 2025
@raja2576 raja2576 deleted the fix/photoswipe-mailchimp-raja_kr_rana_raja2576 branch June 18, 2025 16:30
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.

1 participant