Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for pc apply: add site, change entry type, localise relations #12715

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Feb 22, 2023

Description

Replication instructions: #12702 (comment)

What’s happening:

  • When applying external project config changes, BaseRelationField->afterSave() adds the LocalizeRelations job to the queue
  • but then the change for an entryType (e.g. from hasTitleField: true to false) triggers Sections->handleChangedEntryType()
  • which, for singles, triggers Sections->_ensureSingleEntry(), which triggers the element to be saved and propagated
  • that then triggers Relations->saveRelations(), which saves the existing relation that had sourceSiteId of null to sourceSiteId of the newly added site
  • when the LocalizeRelations job is ready to do its job, there are no relations to localise cause the one it was supposed to localise now has the sourceSiteId of the newly added site
  • this results in the relation being present in the newly added site but missing from the primary one

The fix:
Only attempt to save relations if we’re not applying PC changes to a Single.

Related issues

#12702

@i-just i-just requested a review from a team as a code owner February 22, 2023 11:01
@i-just i-just marked this pull request as draft February 22, 2023 11:14
@i-just i-just marked this pull request as ready for review February 22, 2023 11:33
@brandonkelly brandonkelly self-requested a review as a code owner February 22, 2023 19:55
…ges-relations-broken

# Conflicts:
#	CHANGELOG.md
@brandonkelly brandonkelly merged commit 4f30a5e into develop Feb 22, 2023
@brandonkelly brandonkelly deleted the bugfix/12702-pc-multisite-singles-et-changes-relations-broken branch February 22, 2023 19:56
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