genkgo / ember-localforage-adapter

Offline usage for Ember Data, based on localstorage adapter, but now uses Mozilla's localforage as data source
Other
133 stars 26 forks source link

Fixes and upgrades for 113 #48

Closed sebweaver closed 9 years ago

sebweaver commented 9 years ago

This PR includes:

About issue #45, here are the 2 groups of 2 cases this PR covers:

  1. hasMany relationships:
    1. when some of the related records are missing in the localForage
    2. when some of the related records are external to localForage and unreachable
  2. belongsTo relationships:
    1. when the related record is missing in the localForage
    2. when the related record is external to localForage and unreachable

For the first group of cases, the main record is resolved with its known and reachable related records, others are ignored.

For the second group of cases, the main record is resolved but without the missing or unreachable related records.

All of these cases warns the user in the console.

Note # 1: In order to mock-up external relationships in the tests, and for the sake of simplicity, I just added a new set of models and fixtures which are loaded in localForage under a dedicated namespace. The corresponding new records, involved in relationships from the main localForage, are loaded by their own adapters (since the fix of #46) and consequently act as they were loaded from elsewhere/anywhere.

Note # 2: Some fixes and improvements of this PR can be easily pick to the master branch, except those concerning the loading of the relationships which is now obsolete. I will create another PR for that.

Thank you for reviewing! :smiley:

frederikbosch commented 9 years ago

@sebweaver Hope to have a look at this next week. I would favour just giving you direct access to the repo. Having multiple maintainers would be great. Still not up to it?

sebweaver commented 9 years ago

Ok to have access to the repo. I like this project. Thank you for your trust.

"With great power comes great responsibility" :smile:

frederikbosch commented 9 years ago

@sebweaver That's right! You should have access now.

sebweaver commented 9 years ago

Thank you!

Do you still want to review this PR? Or can I merge it?

As you have probably seen Ember data 2.1 has been released yesterday. However, before you tag and release ELA 2.1, I'd like to pick some commits (i.e. new tests and other improvements) from this PR too.

frederikbosch commented 9 years ago

@sebweaver Actually I walked through the PR really fast. It looked ok, but was far from a thorough review. Tests are passing, usually a good indication. I'd merge it if I were you.

sebweaver commented 9 years ago

Done. Do you want me to tag 1.13.3 too ?

frederikbosch commented 9 years ago

Sure. You are free to go. I have no reason to limit your actions on this repo. Let us work together to improve ELA in many ways.

sebweaver commented 9 years ago

Ok, fine, I'll do it very soon.

sebweaver commented 9 years ago

Tag has be created. I let you publish it on NPM and Bower.