WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#53488 closed defect (bug) (fixed)

The `action` passed to jQuery.ajax is possibly `null`

Reported by: ixkaito Owned by: desrosj
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: Widgets Keywords: has-patch commit
Focuses: javascript Cc:

Description

When I add widgets from the Customizer, the console displays a TypeError action is null. Need to check if action and action.data exist.

Attachments (2)

2021-06-23 17.34.37.png (1019.0 KB) - added by ixkaito 3 months ago.
53488.diff (520 bytes) - added by ixkaito 3 months ago.

Download all attachments as: .zip

Change History (10)

@ixkaito
3 months ago

#1 @noisysocks
3 months ago

  • Milestone changed from Awaiting Review to 5.8

#2 @noisysocks
3 months ago

Why is data null? Perhaps @wordpress/customize-widgets is doing something wrong cc. @kevin940726.

#3 @ixkaito
3 months ago

@noisysocks I'm not sure data is possibly null. Just to be safe.

#4 @zieladam
3 months ago

It seems like action is explicitly set to null here:

https://github.com/WordPress/wordpress-develop/blob/master/src/js/_enqueues/wp/customize/selective-refresh.js#L773-L776

That code hasn't changed for last 5 years so it sounds like we're just triggering an unhappy path introduced in this commit:

https://github.com/WordPress/wordpress-develop/commit/39ecd7846d24f5dd46833b68c6cb90dcdc070398

Given that context, the fix looks good to me.

Last edited 3 months ago by zieladam (previous) (diff)

#5 @zieladam
3 months ago

  • Keywords commit added

#6 @desrosj
3 months ago

Thanks all! Just for cross-referencing in Trac, introduced in [51187].

#7 @desrosj
3 months ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 51238:

Widgets: Avoid a TypeError when adding a widget in the Customizer.

This fixes a bug where action is set to null when adding a widget in the Customizer.

Fixes #53488. See #53421, #53419.

#8 @desrosj
3 months ago

Just realized I forgot to include props on the commit here. My apologies!

I just double checked, and everyone on the ticket has already received props for the 5.8 release, so you'll all be included in the release credits.

Note: See TracTickets for help on using tickets.