Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Remove unloaded objects from nested relationshps #7

Merged
merged 2 commits into from
May 18, 2019

Conversation

veelenga
Copy link

@veelenga veelenga commented May 17, 2019

Explanation of the issue

Let's say we have nested objects to save:

event: [shows: [tickets]]

and we create a new ticket (which belongs to the show).

In that case, the reset relationships function doesn't remove the created in the store record from the list of tickets.

Before save:

show.tickets.mapBy('id') // => [1,2]

after save:

show.tickets.mapBy('id') // => [1,2,3, null]

The explanation of the fix

Now, we properly remove the null object from the relationships and unload it.

Basically, we just had to remove that from the correct parent. Before, the extension was trying to remove ticket from top-level object (i.e. event)

@veelenga veelenga requested review from pavloo and jemilezzet May 17, 2019 23:36
Copy link

@pavloo pavloo left a comment

Choose a reason for hiding this comment

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

makes sense

@veelenga veelenga merged commit 20e3e26 into master May 18, 2019
@veelenga veelenga deleted the fix/remove-nested-relationship branch May 18, 2019 15:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants