Skip to content

Commit

Permalink
add minimal reproduction with passing test (upgrade to Ember 3.21.1 f…
Browse files Browse the repository at this point in the history
…or failure
  • Loading branch information
amk221 committed Sep 3, 2020
1 parent 448217d commit 6bcd696
Show file tree
Hide file tree
Showing 25 changed files with 320 additions and 58 deletions.
5 changes: 5 additions & 0 deletions app/adapters/child.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RESTAdapter from '@ember-data/adapter/rest';

export default class ChildAdapter extends RESTAdapter {

}
5 changes: 5 additions & 0 deletions app/adapters/parent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RESTAdapter from '@ember-data/adapter/rest';

export default class ParentAdapter extends RESTAdapter {

}
1 change: 1 addition & 0 deletions app/components/my-component.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img src={{@src}} {{did-update this.handleUpdateSrc @src}} />
9 changes: 9 additions & 0 deletions app/components/my-component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';

export default class MyComponent extends Component {
@action
handleUpdateSrc() {
console.log('here');
}
}
6 changes: 6 additions & 0 deletions app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Controller from '@ember/controller';
import { inject } from '@ember/service';

export default class ApplicationController extends Controller {
@inject myService;
}
27 changes: 27 additions & 0 deletions app/instance-initializers/preload-store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export function initialize(appInstance) {
const store = appInstance.lookup('service:store');
const myService = appInstance.lookup('service:my-service');

store.pushPayload('parent', {
parent: {
id: 1,
name: 'Parent 1',
avatarURL: 'parent.jpg',
child: 1
}
});

store.pushPayload('child', {
child: {
id: 1,
name: 'Child 1',
avatarURL: 'child.jpg'
}
});

myService.parent = store.peekRecord('parent', 1);
}

export default {
initialize
};
8 changes: 8 additions & 0 deletions app/models/child.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Model, { attr, belongsTo } from '@ember-data/model';

export default class ChildModel extends Model {
@attr() name;
@attr() avatarURL;

@belongsTo('parent', { async: false, inverse: 'child' }) parent;
}
8 changes: 8 additions & 0 deletions app/models/parent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Model, { attr, belongsTo } from '@ember-data/model';

export default class ParentModel extends Model {
@attr() name;
@attr() avatarURL;

@belongsTo('child', { async: false }) child;
}
6 changes: 6 additions & 0 deletions app/routes/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Route from '@ember/routing/route';
import { inject } from '@ember/service';

export default class ApplicationRoute extends Route {
@inject store;
}
5 changes: 5 additions & 0 deletions app/serializers/child.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RESTSerializer from '@ember-data/serializer/rest';

export default class ChildSerializer extends RESTSerializer {

}
5 changes: 5 additions & 0 deletions app/serializers/parent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RESTSerializer from '@ember-data/serializer/rest';

export default class ParentSerializer extends RESTSerializer {

}
4 changes: 4 additions & 0 deletions app/services/my-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Service from '@ember/service';

export default class MyServiceService extends Service {
}
6 changes: 1 addition & 5 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{{!-- The following component displays Ember's default welcome message. --}}
<WelcomePage />
{{!-- Feel free to remove this! --}}

{{outlet}}
<MyComponent @src={{this.myService.parent.child.avatarURL}} />
157 changes: 106 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6bcd696

Please sign in to comment.