Question about the current state of Ember Data in non-Ember frameworks

Hello :wave:, I asked a version of the question in Discord, but it didn’t get any traction, so I wanted to ask it here instead.

:wave: I’m quite out of the loop WRT Ember Data, but I have a few questions :slight_smile:

  • I now see that the description on GH suggests that ED is framework agnostic (I remember reading that was a goal for V5, but I didn’t see it mentioned in this blog post EmberData 5.X Update) - is ED 5 now usable in other frameworks (e.g Vue)?

    • I also don’t see any documentation on how to use Ember in other frameworks on the Ember Data GH page or ember-data-overview - 5.0 - Ember API Documentation even though these pages talk about ED being a "data library for Javascript applications. Does anyone have any pointers to some hidden examples: maybe blog posts, discord threads or similar?
  • Is there a simple way to share an Ember Data instance between 2 frameworks in a given tab, for example, if an Ember app is working as a host app on a page and the Ember app may host/embed another Ember app or a Vue app, is there a simple way to share a single ED store which is owned by the host ED app with the hosted Ember or Vue app?

  • In this blog post (EmberData 5.X Update) it mentions ember-m3 and also maybe bringing some concepts from addons such as m3 into ED core. In our apps we’ve been experimenting with view-models which are separate (currently plain JS) classes which compose together a given model with FE-specific computed properties & helpers/utils for working with a record instance. This pattern intersects with how I understand m3 since it would allow us to use m3 for our base models and then use view models for custom stuff. The downside is that we don’t currently use the store for these view models (not sure this is a good idea) and that brings its own ergonomic downsides.

    • So my question is whether this type of pattern is something being considered / explored in the scope of ED 5? I.e some way to use something like M3 whilst also defining frontend-specific custom attributes / functions for a given model record and fetch from the store a synthetic record which composes the m3-like record with the custom stuff?
1 Like

You and I ended up discussing this here: Can multiple apps on the same page share the same store instance? · Issue #8668 · emberjs/data · GitHub

We also mention this in our roadmap now, which sparked this discussion on discord

My summary for work to be done to be truly framework independent:

  1. For the 5.X series outside of ember-land is the stretch goal, independent of ember-source is the main goal. Basically you (theoretically) should be able to use EmberData with any version of Ember ever. The more ties we cut to the framework itself the more we enable that. Historically it was that coupling that made EmberData a nightmare to maintain and difficult to evolve.

  2. To be usable outside of ember-land requires the same work as being ember-source independent (plus) a small bit of work to expose a simpler integration point for signals (probably just adopt starbeam) (plus) a build plugin so that you can use EmberData with any build tool not just embroider.

1 Like