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

[BUGFIX release] fix relationship merging #5147

Merged
merged 1 commit into from
Aug 25, 2017

Conversation

stefanpenner
Copy link
Member

@stefanpenner stefanpenner commented Aug 24, 2017

When relationship information is merged, the newest information should win.
Unfortunately prior to this PR, relationship containing only link information, would mistakenly purge any existing data information on that relationship.

  1. Update One
{
    data: { /* existing data */ },
    Link: { /* existing data */ },
}
  1. Update Two
{
    Link: { /* new data */ },
}

Previously resulted in:

{
   link: { /* new data */ },
   data: null // oops
}

But now (correctly) results in:

{
   link: { /* new data */ },
   data: { /* existing data */ }
}

@stefanpenner stefanpenner requested a review from hjdivad August 24, 2017 20:17
When relationship information is merged, the newest information should win.
Unfortunately prior to this PR, relationship containing only `link` information, would mistakenly purge any existing `data` information on that relationship.


1. Update One
```js
{
    data: { /* existing data */ },
    Link: { /* existing data */ },
}
```

2. Update Two

```js
{
    Link: { /* new data */ },
}
```

Previously resulted in:

```js
{
   link: { /* new data */ },
   data: null // oops
}
```

But now (correctly) results in:

```js
{
   link: { /* new data */ },
   data: { /* existing data */ }
}
```
Copy link
Member

@hjdivad hjdivad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks great :shipit:

Test looks good but could be minimized. Unless I'm missing something we can drop kid both in the modeling and the payload to make the test more focused.

data: [
{
id: '1',
type: 'kids',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this at all?

Can't we minimize the test to only have middle-ager and elder?

I think now that we've figured out the root cause the kid relationship adds noise to the test.

@stefanpenner stefanpenner merged commit 50592d8 into master Aug 25, 2017
@stefanpenner stefanpenner deleted the fix-relationship-merging branch August 25, 2017 00:12
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.

3 participants