Skip to content

fix: register reader data handlers after listeners#3901

Merged
dkoo merged 3 commits into
releasefrom
hotfix/reader-data-handlers
Apr 21, 2025
Merged

fix: register reader data handlers after listeners#3901
dkoo merged 3 commits into
releasefrom
hotfix/reader-data-handlers

Conversation

@leogermani

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

Fixes an issue where data events handlers were not being fired and not updating the user status

How to test the changes in this Pull Request:

  1. On trunk
  2. Register as a new user and subscribe to a newsletter
  3. Visit My Account > Newsletter
  4. Check the newspack_reader_data_item_is_newsletter_subscriber and newspack_reader_data_item_newsletter_subscribed_lists and confirm they don't exist
  5. Change your newsletter selection and save, confirm nothing changes on the user meta
  6. Checkout this branch and change your newsletters again
  7. Confirm you see the user meta being updated as expected

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@leogermani leogermani added the [Status] Needs Review The issue or pull request needs to be reviewed label Apr 8, 2025
@leogermani leogermani self-assigned this Apr 8, 2025
@leogermani leogermani requested a review from a team as a code owner April 8, 2025 21:32

@miguelpeixe miguelpeixe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given the severity of handlers being registered before their actions/listeners, could you include some logging, or even throw an exception, in the handler for cases like that?

The current approach to return a WP_Error made it go unnoticed for 15 months, as we just learned.

@leogermani

Copy link
Copy Markdown
Contributor Author

right, throwing probably sounds right, but I'm afraid of doing it at this point and breaking live sites.

I'll add logging

@leogermani

Copy link
Copy Markdown
Contributor Author

@miguelpeixe , added logs. Try to register a handler before init and see them in the logs

@leogermani leogermani requested a review from miguelpeixe April 17, 2025 14:36
@github-actions github-actions Bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Apr 17, 2025
@dkoo dkoo merged commit df71105 into release Apr 21, 2025
@dkoo dkoo deleted the hotfix/reader-data-handlers branch April 21, 2025 20:29
matticbot pushed a commit that referenced this pull request Apr 21, 2025
## [6.4.3](v6.4.2...v6.4.3) (2025-04-21)

### Bug Fixes

* register reader data handlers after listeners ([#3901](#3901)) ([df71105](df71105))
@matticbot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 6.4.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released [Status] Approved The pull request has been reviewed and is ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants