[6.x] Fix sync/desync on localizable nested fields#14335
Open
duncanmcclean wants to merge 1 commit into6.xfrom
Open
[6.x] Fix sync/desync on localizable nested fields#14335duncanmcclean wants to merge 1 commit into6.xfrom
duncanmcclean wants to merge 1 commit into6.xfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes syncing/desyncing nested fields (like grid, group, replicator, etc) when
localizable: true.In v5, when a nested field's value was updated, it would emit events which would eventually make their way back up to the respective fieldtype component (eg.
Grid.vue), which would emit an event of its own, and eventually update the container, causing thelocalizedFieldsstate to be updated.Publish Containers were completely rewritten in v6 — methods/state can be accessed by child components via injection, doing away with the need for emitting events all the way up the chain.
When a nested field's value is updated, its value is updated directly in the container's state without needing to go up the chain to the nested fieldtype component. However, this meant that the nested key was being added to the
localizedFieldsarray, rather than the key of the "root" field.This PR ensures we pass the path of the "root" field to
syncField()anddesyncField()instead of the nested field's full path. Not 100% sure if it's the right solution, so if you can think of an alternative, let me know!Fixes #13822