Skip to content

Instantly share code, notes, and snippets.

@jenweber
Created May 26, 2021 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jenweber/0d81d2cab71aba5b6319dd59b848274d to your computer and use it in GitHub Desktop.
Save jenweber/0d81d2cab71aba5b6319dd59b848274d to your computer and use it in GitHub Desktop.
Ember Data Guides brainstorm

Outline

Intro

touch on the overall goals what is different than Vue or React You can store state locally, and you can strongly relate records like a database would Tie in with attrs and belongs-to Managing models You have choices if you want to do something different Why use Ember Data over fetch (avoiding unnecessary queries, CRUD logic is not intermingled with the logic for the rest of your app, reactivity) Reactivity - with fetch, if you POST then you would need to GET again in order to rerender the collection. Don’t have to do this with Ember Data

Mini Walkthrough/quickstart - where to put this?

Could link to a playground where you can try it Could have a GitHub application where you load it locally Goal is to show how to put the pieces together

Models

Transforms - you can create custom types (clarify with data team about recommended strategies)

Configuring the Adapter

Types of adapters What the adapter does for you only the basics here

Finding records

See what comes back from find What is ED doing automatically

Configure the serializer

My FE & BE don’t need to be exactly in sync. Abstraction layer What is the serializer doing for you only the basics here

Create, Update, Delete

Relationships

Writing your own Serializer

Which functions to highlight Escape hatches for really non-compliant APIs (half & half JSONAPI and REST, for example, non-restful APIs). Show the method where you can receive data and return whatever you want.

Writing your own Adapter

Which functions to highlight

Advanced

Performance Metadata Using a subset of data features (Find out how far along this is. We could teach these individual pieces upfront to build system understanding, potentially) PushPayload useful for websockets and other streaming connections to a back end Could use this with some improvements to walk through step by step and communicate “why”

Possibly Ember Data needs a full-featured Tutorial most of all. Could extend Super Rentals? Benefit of CI-backed code samples

Current experience: Easy to find things. Need to preserve thsi.

Some broad improvements Help people to think/learn about the system as opposed to ad-hoc util functions. What data do I need, where do I need it, what kinds of operations? Which keys are named in an annoying way? Sell the power of the abstractions before they even get into the details Mention that ED is Fastboot/SSR compatible Get the data server side and rehydrate

What to do with https://guides.emberjs.com/release/models/pushing-records-into-the-store/ ?

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