Skip to content

Conversation

@raja2576
Copy link

@raja2576 raja2576 commented Jun 18, 2025

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 🔧

Signed-off-by: raja2576 <164044997+raja2576@users.noreply.github.com>
@raja2576 raja2576 force-pushed the fix/photoswipe-mailchimp-raja2576 branch from b277893 to c22f234 Compare June 18, 2025 16:48
@pratik-mahalle
Copy link

Hey @raja2576, Thank you for raising the pr. Our team will soon review the changes

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.

2 participants