Skip to content

fix: add guard in clPhotoswipe and correct Mailchimp URL#25

Closed
raja2576 wants to merge 1 commit intokeploy:mainfrom
raja2576:main
Closed

fix: add guard in clPhotoswipe and correct Mailchimp URL#25
raja2576 wants to merge 1 commit intokeploy:mainfrom
raja2576:main

Conversation

@raja2576
Copy link
Copy Markdown

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 🔧

@raja2576 raja2576 closed this Jun 19, 2025
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