ember-data-model-fragments: Incompatibility with ember-data 3.13.0

This error appears as soon as you upgrade from e-d 3.12.x to e-d 3.13.0

 TypeError: Cannot read property 'id' of null
    at new InternalModel (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/addon-tree-output/@ember-data/store/-private.js:4697:1)
    at Store.createFragment (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/addon-tree-output/ember-data-model-fragments/ext.js:134:1)
    at createFragment (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/addon-tree-output/ember-data-model-fragments/fragment.js:213:1)
    at setupFragment (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/addon-tree-output/ember-data-model-fragments/attributes.js:97:1)
    at EditionModel.get (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/addon-tree-output/ember-data-model-fragments/attributes.js:259:1)
    at /var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:3324:1
    at untrack (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:1247:1)
    at ComputedProperty.get (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:3323:1)
    at EditionModel.CPGETTER_FUNCTION [as saturday] (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:1044:1)
    at EditionService.get starts [as starts] (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/pawchewgo/services/edition.js:45:1)
    at getPossibleMandatoryProxyValue (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:1269:1)
    at get (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:1342:1)
    at /var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:565:1
    at track (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:1224:1)
    at NestedPropertyReference.compute (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:564:1)
    at NestedPropertyReference.value (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:376:1)
    at valueOf (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:4617:1)
    at Array.map (<anonymous>)
    at CapturedPositionalArguments.value (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:4594:1)
    at ClassBasedHelperReference.compute (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:738:1)
    at ClassBasedHelperReference.value (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:376:1)
    at ContentTypeReference.value (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:498:1)
    at ReferenceCache.initialize (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/reference.js:357:1)
    at ReferenceCache.peek (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/reference.js:326:1)
    at Function.initialize (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:847:1)
    at Object.evaluate (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:824:1)
    at AppendOpcodes.evaluate (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:73:1)
    at LowLevelVM.evaluateSyscall (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:3295:1)
    at LowLevelVM.evaluateInner (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:3241:1)
    at LowLevelVM.evaluateOuter (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:3233:1)
    at VM.next (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:5299:1)
    at TemplateIteratorImpl.next (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@glimmer/runtime.js:5335:1)
    at RootState.render (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:5614:1)
    at TransactionRunner.runInTransaction (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:2109:1)
    at runInTransaction (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/metal/index.js:2238:1)
    at InertRenderer._renderRoots (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:5911:1)
    at InertRenderer._renderRootsTransaction (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:5949:1)
    at InertRenderer._renderRoot (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:5868:1)
    at InertRenderer._appendDefinition (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:5783:1)
    at InertRenderer.appendOutletView (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/@ember/-internals/glimmer/index.js:5769:1)
    at invokeWithOnError (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/backburner.js:349:1)
    at Queue.flush (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/backburner.js:229:1)
    at DeferredActionQueues.flush (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/backburner.js:426:1)
    at Backburner._end (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/backburner.js:960:1)
    at Backburner._boundAutorunEnd (/var/folders/f7/4l5jd79d4zd4pf_rym3xbyzw0000gn/T/broccoli-28643HSC1Hg6tjrh6/out-388-broccoli_persistent_filter_autoprefixer_filter/assets/backburner.js:629:1)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)```

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 36 (19 by maintainers)

Most upvoted comments

I’m working (slowly) on a fix for this. Have tests at least running and failing for proper reasons on 3.12. I’ll update here as I have more information 😄.

Just when i started being ok with ED and its quirks… it rips the carpet out from under me again… crying_cat_face

I can understand that you are pissed of by breaking your production build but I don’t think it’s Ember Data’s fault that this addon heavily relies on private APIs. Public APIs were discussed and defined as part of the RFC process with this addon in mind long time ago. Ember Data has exported some private APIs only to not break this addon. At some point of time this gets to costy and the private API has to be removed. I think it was long enough for all consumers of this addon (including myself) to start refactoring it based on public APIs.

I didn’t find this until i rolled to production with 3.13… Yay!

I don’t want to offend you but it’s not the fault of Ember Data or the people working on it if your tests and QA aren’t catching this bug before shipped to production…

Are there other solutions for those that need dirtying? I have probably 20+ Fragments.

FYI, I hope to have a release out that works with 3.13+ sometime next week.

For everyone watching this issue there’s a 5.0-beta release with the RecordData refactor. If you could try it out in your apps and report any issues that would be great (requires Ember Data upgrade) https://github.com/lytics/ember-data-model-fragments/releases/tag/5.0.0-beta.0

Update - I have a branch (richgt/ember-data.model-fragments -> richgt/model-data-ember-3.13 that has 5 failing tests remaining. I’m a little stumped on the remaining tests, if anybody has any ideas, I’d love some help here…

We reviewed the usage of Ember Data Model Fragments and noticed that it’s in most cases only used to have a schema for complex data types like POJOs and arrays of POJOs. We noticed that we could achieve the same with native classes and Ember Data transforms. We decided to drop Ember Data Model Fragments.

Please note that this approach is only providing a subset of features that Ember Data Model Fragments had. It’s only a schema + serializer. If you need dirty tracking of Ember Data model to work you must follow an immutable pattern for that objects / collection of objects. Assigning a POJO to the attribute and have it automatically converted to an instance of that class would also not work.

These limitations simplify the code and fit better to Octane pattern in my opinion. But you may have another feeling. I would recommend to play around with that approach before making a decision.

I can try to write a more detailed blog post about this approach. But not sure when I will have the time to do so.

We’re also pretty heavily dependent on this, and will be stuck on 3.12 until this get’s fixed, so we’re happy to help out. Has anybody made any progress on this? If not, we may try to spike this.

Happy to provide a review, @igorT had tried to spike this before, I suspect we could again.

Just when i started being ok with ED and its quirks… it rips the carpet out from under me again… 😿 I didn’t find this until i rolled to production with 3.13… Yay!

I have a feeling that it’s almost a complete rewrite. A spike of the conversion was attempted here but I don’t think it got too far.

Are there other solutions for those that need dirtying? I have probably 20+ Fragments.

ember-changeset provides a nice way to track changes. Not integrated with Ember Data but that’s more a feature than a limitation in my opinion. Might be require quiet some refactoring if the app is currently relying on Ember Data and Ember Data Model Fragments for change tracking.