Skip to content

Fix TypeError in notifications when note has no actions#108577

Draft
StevenDufresne wants to merge 1 commit intotrunkfrom
fix/notifications-getactions-undefined
Draft

Fix TypeError in notifications when note has no actions#108577
StevenDufresne wants to merge 1 commit intotrunkfrom
fix/notifications-getactions-undefined

Conversation

@StevenDufresne
Copy link
Contributor

@StevenDufresne StevenDufresne commented Feb 8, 2026

Fixes CALYPSO-2HCW

Proposed Changes

  • Add null guard in hasAction helper within both body.tsx and body.jsx to handle when getActions() returns undefined

Why are these changes being made?

#108325 introduced code in body.tsx and body.jsx that calls getActions(note) and then immediately calls .hasOwnProperty() on the result. When a notification has no action blocks, getActions() returns undefined, causing a TypeError tracked as CALYPSO-2HCW.

The fix adds a null guard in the hasAction helper in both files — the same files where the bug was introduced.

Testing Instructions

  1. Open the WordPress.com notifications panel
  2. Click on various notification types (likes, follows, comments) — verify action buttons and pending approval badges render correctly
  3. If possible, trigger a notification without action blocks and verify it renders without errors
  4. The fix is best validated by confirming the Sentry error stops recurring after deploy

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@matticbot
Copy link
Contributor

matticbot commented Feb 8, 2026

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • blaze-dashboard
  • help-center
  • notifications
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/notifications-getactions-undefined on your sandbox.

@StevenDufresne StevenDufresne force-pushed the fix/notifications-getactions-undefined branch from 8bb5b7b to 7a580ce Compare February 8, 2026 03:48
@StevenDufresne StevenDufresne force-pushed the fix/notifications-getactions-undefined branch from 7a580ce to 4ad040c Compare February 9, 2026 05:02
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