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

Problem with deep HasMany merge #1560

Open
Merkur39 opened this issue Nov 15, 2024 · 0 comments
Open

Problem with deep HasMany merge #1560

Merkur39 opened this issue Nov 15, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Merkur39
Copy link
Member

Merkur39 commented Nov 15, 2024

In the example below, the setHasManyItem and updateHasManyItem helpers cannot be used to remove values from relationTypes.

{
  _id: 'contact0',
  name: 'Alice',
  relationships: {
    related: {
      data: [
        {
          _id: 'related0',
          metadata: {
            relationTypes: ['spouse', 'friend']
          }
        }
      ]
    }
  }
}

At issue are two merges here and there in setHasManyItem.

The documentation shows a manual approach.

We already got around the problem here cozy-contacts.

PS: Another subject, but we've encountered a similar problem with the cozy-client store.
Both approaches assume that the value passed as an argument is not up to date with the original document.
Maybe it would be a good idea to review the approach? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant