Data: Cannot set relationship in 3.2.0

Created on 5 Jul 2018  路  12Comments  路  Source: emberjs/data

Clearing out the relationship then setting it no longer works.

e.g:

myModel.setProperties({
  name: null,
  myRel: null
});

myModel.set('myRel', myRel);

Passing in 2.18.2: Twiddle
Switch to 3.2.0 for a failure

Bug

Most helpful comment

The bug is here.
I have the Model Offer, including
type: belongsTo('offerType', {async: true})
and Model Offer-type with some properties.
With updating from 2.12 to 3.5 Ember breaks down the app cause if I do
offer.set('type', someNewTypeFromStore)
I'll get finally
offer.get('type') === null

All 12 comments

This bug might be fixed now?

It is fixed.

@runspired is there a good release to test this in?

@jrjohnson fix was released in all stable versions

Oh OK, I still have a possibly related issue in 3.3.1. I will try and create a useful reproduction and a new ticket.

Same here, I tried emberjs/data#master, but still having problems. Currently stuck on 2.18.0

@amk221 I have mega doubts that this issue still exists on master without a reproducible failing scenario. I did look at the repro you mentioned here: https://github.com/amk221/-ember-data-geturl-not-a-function/commit/3ab9aa7d527cac88d126fdf81d7b87f0a13c02e4 and as others mentioned the test itself is incorrect and passes when fixed.

I noticed your comments:

The actual test does some setting and unsetting of relationships. But still comes back with this error.
i.e. Setting the relationship from null back to an ED model does not work due to the above bug in 5517, therefore, the test ends up deepEqualing an ED model with null, which triggers the error in question.

However we have tests that cover exactly this scenario, so without a clear test setup showing this problem still exists for some set of conditions I'm inclined to believe it's more likely an issue with app code.

ok, thank you for your input. I'll try to amalgamate the two and come up with a better failing case.

I still get (0 , _emberMetal.get)(...).getURL is not a function with ED 3.5.0 in this minimal test case

The bug is here.
I have the Model Offer, including
type: belongsTo('offerType', {async: true})
and Model Offer-type with some properties.
With updating from 2.12 to 3.5 Ember breaks down the app cause if I do
offer.set('type', someNewTypeFromStore)
I'll get finally
offer.get('type') === null

We're seeing the same issue as @dmarkin in 3.3.0. Any work arounds?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bekicot picture bekicot  路  4Comments

buschtoens picture buschtoens  路  4Comments

stefanpenner picture stefanpenner  路  4Comments

jlami picture jlami  路  3Comments

concertiv picture concertiv  路  4Comments