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

[BETA] new records are improperly reloaded when relationships are set #5655

Closed
wagenet opened this issue Sep 27, 2018 · 8 comments
Closed

[BETA] new records are improperly reloaded when relationships are set #5655

wagenet opened this issue Sep 27, 2018 · 8 comments

Comments

@wagenet
Copy link
Member

wagenet commented Sep 27, 2018

Version: ember-data@3.5.0-beta.2

Triggering code:

commit = this.createRecord('github-commit', commitAttrs);
commit.set('app', this.peekRecord('app', appId));

error.stack:

"Error: Attempted to handle event `notFound` on <github-commit:OirVnUtLCe_0:b0f3b5974e8d654702b6cda99f9d38ae2fc77492> while in state root.loaded.created.uncommitted. 
    at new EmberError (http://localhost:7357/assets/vendor.js:25720:31)
    at InternalModel._unhandledEvent (http://localhost:7357/assets/vendor.js:173776:13)
    at InternalModel.send (http://localhost:7357/assets/vendor.js:173624:14)
    at InternalModel.notFound (http://localhost:7357/assets/vendor.js:173571:12)
    at promise.then.error (http://localhost:7357/assets/vendor.js:174434:21)
    at tryCatcher (http://localhost:7357/assets/vendor.js:71524:21)
    at invokeCallback (http://localhost:7357/assets/vendor.js:71696:33)
    at publish (http://localhost:7357/assets/vendor.js:71682:9)
    at publishRejection (http://localhost:7357/assets/vendor.js:71617:5)
    at http://localhost:7357/assets/vendor.js:63918:16"

Chrome DevTools Stack:

onerrorDefault (rsvp.js:24)
trigger (rsvp.js:66)
(anonymous) (rsvp.js:886)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
end (backburner.js:513)
_run (backburner.js:793)
_join (backburner.js:769)
join (backburner.js:567)
join (index.js:164)
hash.error (rest.js:880)
fire (jquery.js:3268)
fireWith (jquery.js:3398)
done (jquery.js:9307)
(anonymous) (jquery.js:9548)
(anonymous) (fake_xml_http_request.js:137)
dispatchEvent (fake_xml_http_request.js:181)
dispatchEvent (pretender.js:216)
xhr.(anonymous function) (pretender.js:226)
load (async)
createHandler (pretender.js:224)
createPassthrough (pretender.js:242)
send (pretender.js:166)
send (jquery.js:9600)
ajax (jquery.js:9206)
_ajaxRequest (rest.js:893)
_ajax (rest.js:913)
(anonymous) (rest.js:883)
initializePromise (rsvp.js:397)
Promise (rsvp.js:877)
ajax (rest.js:873)
(anonymous) (application.js:41)
cachedRequest (local-cache.js:118)
ajax (application.js:41)
superWrapper (ember-utils.js:308)
findRecord (rest.js:436)
Ember.RSVP.Promise.resolve.then (-private.js:6971)
tryCatcher (rsvp.js:200)
invokeCallback (rsvp.js:372)
(anonymous) (rsvp.js:436)
(anonymous) (rsvp.js:14)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
end (backburner.js:513)
_run (backburner.js:793)
_join (backburner.js:769)
join (backburner.js:567)
join (index.js:164)
jqXHR.done (ajax-request.js:213)
fire (jquery.js:3268)
fireWith (jquery.js:3398)
done (jquery.js:9305)
(anonymous) (jquery.js:9548)
(anonymous) (fake_xml_http_request.js:137)
dispatchEvent (fake_xml_http_request.js:181)
_readyStateChange (fake_xml_http_request.js:389)
_setResponseBody (fake_xml_http_request.js:453)
respond (fake_xml_http_request.js:474)
(anonymous) (pretender.js:378)
resolve (pretender.js:429)
(anonymous) (pretender.js:420)
setTimeout (async)
handleResponse (pretender.js:419)
_handleRequest (pretender.js:377)
(anonymous) (pretender.js:388)
tryCatcher (rsvp.js:200)
invokeCallback (rsvp.js:372)
publish (rsvp.js:358)
(anonymous) (rsvp.js:14)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
end (backburner.js:513)
_run (backburner.js:793)
_join (backburner.js:769)
join (backburner.js:567)
join (index.js:164)
jqXHR.done (ajax-request.js:213)
fire (jquery.js:3268)
fireWith (jquery.js:3398)
done (jquery.js:9305)
(anonymous) (jquery.js:9548)
(anonymous) (fake_xml_http_request.js:137)
dispatchEvent (fake_xml_http_request.js:181)
_readyStateChange (fake_xml_http_request.js:389)
_setResponseBody (fake_xml_http_request.js:453)
respond (fake_xml_http_request.js:474)
(anonymous) (pretender.js:378)
resolve (pretender.js:429)
(anonymous) (pretender.js:420)
setTimeout (async)
handleResponse (pretender.js:419)
_handleRequest (pretender.js:377)
(anonymous) (pretender.js:388)
tryCatcher (rsvp.js:200)
invokeCallback (rsvp.js:372)
publish (rsvp.js:358)
(anonymous) (rsvp.js:14)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
end (backburner.js:513)
_run (backburner.js:793)
run (backburner.js:556)
run (index.js:113)
tn.on (overview-graph.js:509)
call (d3-dispatch.min.js:3)
u (d3-transition.min.js:3)
(anonymous) (d3-transition.min.js:3)
(anonymous) (d3-timer.min.js:3)
d (d3-timer.min.js:3)
h (d3-timer.min.js:3)
requestAnimationFrame (async)
v (d3-timer.min.js:3)
restart (d3-timer.min.js:3)
w (d3-timer.min.js:3)
(anonymous) (d3-transition.min.js:3)
v (d3-transition.min.js:3)
o.selection.transition (d3-transition.min.js:3)
S (d3-transition.min.js:3)
redraw (overview-graph.js:499)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
end (backburner.js:513)
_run (backburner.js:793)
run (backburner.js:556)
run (index.js:113)
mockComplete (websocket.js:22)
send (websocket.js:87)
sendRequest (websocket.js:333)
(anonymous) (websocket.js:217)
tryCatcher (rsvp.js:200)
invokeCallback (rsvp.js:372)
publish (rsvp.js:358)
(anonymous) (rsvp.js:14)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
end (backburner.js:513)
_runExpiredTimers (backburner.js:851)
setTimeout (async)
setTimeout (backburner.js:32)
_installTimerTimeout (backburner.js:898)
_later (backburner.js:811)
later (backburner.js:642)
later (index.js:402)
createSocket (websocket.js:103)
socket (websocket.js:138)
createRequest (websocket.js:208)
getResource (websocket.js:238)
fetchWS (local-cache.js:88)
getResource (local-cache.js:99)
(anonymous) (socketable.js:20)
withToken (tokenizable.js:90)
(anonymous) (socketable.js:19)
initializePromise (rsvp.js:397)
Promise (rsvp.js:877)
getResource (socketable.js:18)
Ember.RSVP.Promise (endpoints-list.js:260)
initializePromise (rsvp.js:397)
Promise (rsvp.js:877)
load (endpoints-list.js:227)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
end (backburner.js:513)
_run (backburner.js:793)
_join (backburner.js:769)
join (backburner.js:567)
join (index.js:164)
hash.success (rest.js:876)
fire (jquery.js:3268)
fireWith (jquery.js:3398)
done (jquery.js:9305)
(anonymous) (jquery.js:9548)
(anonymous) (fake_xml_http_request.js:137)
dispatchEvent (fake_xml_http_request.js:181)
_readyStateChange (fake_xml_http_request.js:389)
_setResponseBody (fake_xml_http_request.js:453)
respond (fake_xml_http_request.js:474)
(anonymous) (pretender.js:378)
resolve (pretender.js:429)
(anonymous) (pretender.js:420)
setTimeout (async)
handleResponse (pretender.js:419)
_handleRequest (pretender.js:377)
(anonymous) (pretender.js:388)
tryCatcher (rsvp.js:200)
invokeCallback (rsvp.js:372)
publish (rsvp.js:358)
(anonymous) (rsvp.js:14)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
end (backburner.js:513)
_run (backburner.js:793)
_join (backburner.js:769)
join (backburner.js:567)
join (index.js:164)
jqXHR.done (ajax-request.js:213)
fire (jquery.js:3268)
fireWith (jquery.js:3398)
done (jquery.js:9305)
(anonymous) (jquery.js:9548)
(anonymous) (fake_xml_http_request.js:137)
dispatchEvent (fake_xml_http_request.js:181)
_readyStateChange (fake_xml_http_request.js:389)
_setResponseBody (fake_xml_http_request.js:453)
respond (fake_xml_http_request.js:474)
(anonymous) (pretender.js:378)
resolve (pretender.js:429)
(anonymous) (pretender.js:420)
setTimeout (async)
handleResponse (pretender.js:419)
_handleRequest (pretender.js:377)
(anonymous) (pretender.js:388)
tryCatcher (rsvp.js:200)
invokeCallback (rsvp.js:372)
publish (rsvp.js:358)
(anonymous) (rsvp.js:14)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_ensureInstance (backburner.js:905)
schedule (backburner.js:593)
(anonymous) (rsvp.js:8)
fulfill (rsvp.js:309)
resolve$1 (rsvp.js:284)
(anonymous) (rsvp.js:402)
setTimeout (async)
Ember.RSVP.Promise.resolve (-utils.js:19)
initializePromise (rsvp.js:397)
Promise (rsvp.js:877)
nextTickPromise (-utils.js:18)
visit (setup-application-context.js:24)
(anonymous) (deploy-tracking-test.js:113)
runTest (qunit.js:1774)
run (qunit.js:1760)
(anonymous) (qunit.js:1981)
advanceTaskQueue (qunit.js:1373)
advance (qunit.js:1354)
begin (qunit.js:3126)
(anonymous) (qunit.js:2368)
setTimeout (async)
internalStart (qunit.js:2359)
resume (qunit.js:2320)
(anonymous) (qunit.js:2094)
tryCatcher (rsvp.js:200)
invokeCallback (rsvp.js:372)
publish (rsvp.js:358)
(anonymous) (rsvp.js:10)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_ensureInstance (backburner.js:905)
schedule (backburner.js:593)
(anonymous) (rsvp.js:8)
fulfill (rsvp.js:309)
resolve$1 (rsvp.js:284)
(anonymous) (rsvp.js:402)
setTimeout (async)
Ember.RSVP.Promise.resolve (-utils.js:19)
initializePromise (rsvp.js:397)
Promise (rsvp.js:877)
nextTickPromise (-utils.js:18)
setupApplicationContext (setup-application-context.js:83)
(anonymous) (index.js:177)
callHook (qunit.js:1793)
runHook (qunit.js:1818)
advanceTaskQueue (qunit.js:1373)
advance (qunit.js:1354)
begin (qunit.js:3126)
(anonymous) (qunit.js:2368)
setTimeout (async)
internalStart (qunit.js:2359)
resume (qunit.js:2320)
(anonymous) (qunit.js:2094)
tryCatcher (rsvp.js:200)
invokeCallback (rsvp.js:372)
publish (rsvp.js:358)
(anonymous) (rsvp.js:14)
invoke (backburner.js:247)
flush (backburner.js:167)
flush (backburner.js:326)
_end (backburner.js:748)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
characterData (async)
next (backburner.js:17)
_scheduleAutorun (backburner.js:913)
_end (backburner.js:753)
Backburner._boundAutorunEnd (backburner.js:483)
@wagenet
Copy link
Member Author

wagenet commented Sep 27, 2018

models/github-commit.js:

import DS from 'ember-data';

const { attr, belongsTo, hasMany } = DS;

export default DS.Model.extend({
  deploys: hasMany('deploy'),
  app: belongsTo('app'),

  sha: attr('string'),
  message: attr('string'),
  url: attr('string')
});

Note that the reverse association is not defined in models/app.js

@jeanduplessis
Copy link

@wagenet I've run into a similar error trying to upgrade from ember-data 3.4. Have you managed to find a workaround for this issue?

@wagenet
Copy link
Member Author

wagenet commented Mar 1, 2019

@jeanduplessis our solution ended up being to refactor some of our code to avoid doing this. As it turns out, this was better architecturally for our app anyway.

@runspired
Copy link
Contributor

@jeanduplessis still an issue? if so I'd love a test PR.

@jeanduplessis
Copy link

@runspired, unfortunately, I moved on from the project so not sure about the state of things anymore.

@kategengler
Copy link
Member

kategengler commented Jan 4, 2022

Can confirm this as an issue in at least ember-data 3.12

Sorry, I have the inverse problem (the relationship is reloaded when setting to a new record)

@runspired
Copy link
Contributor

Opened #7844 for @kategengler, closing this issue.

@snewcomer
Copy link
Contributor

@kategengler I put together this test to show we may have fixed it in the meantime. Would you mind checking it out and letting me know if I am missing something?

#7902

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants