Skip to content

[5.x]: Nested addresses owned by a custom field can appear in the wrong context #15678

@AugustMiller

Description

@AugustMiller

What happened?

Description

I think this is two distinct issues:

  1. Address elements nested within a custom field on a user can appear in the main "Addresses" view.
  2. After deleting an address field, the fieldId is not cleaned up, nor are the nested elements deleted.

Running garbage collection didn't seem to help, but this resave command took care of it:

ddev craft resave/addresses --element-id [[offending address ID]] --set fieldId --to "fn(\$element) => null"

Steps to reproduce

  1. Create an Addresses field;
  2. Add it to the User Profile field layout;
  3. Create a nested address element on a user;
  4. Observe that new address in the Addresses screen (despite it being owned by a custom field);

Additionally:

  1. Delete the custom Addresses field;
  2. View the Addresses screen for the same user;
  3. Observe error about a missing field;

Expected behavior

Addresses owned by custom fields are excluded from the native address list. (I think?)

Actual behavior

Addresses owned by custom fields leak into native address list.

Craft CMS version

5.4.1

PHP version

8.2.20

Operating system and version

macOS/Docker

Database type and version

MySQL 8.0.36

Image driver and version

No response

Installed plugins and versions

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions