Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with saving embedded models inside embedded models #512

Open
emoryy opened this issue May 31, 2017 · 0 comments
Open

Bug with saving embedded models inside embedded models #512

emoryy opened this issue May 31, 2017 · 0 comments

Comments

@emoryy
Copy link

emoryy commented May 31, 2017

There seems to be problems with saving embedded models.
When you have embedded models inside embedded models, then the third level models will be only persisted to the database with the first save after the app loaded.
If after a first save you add/remove third level models, then saving the top level model won't have any effect.

Version info

DEBUG: -------------------------------
DEBUG: Ember      : 2.13.2
DEBUG: Ember Data : 2.13.1
DEBUG: Firebase   : 3.9.0
DEBUG: EmberFire  : 0.0.0
DEBUG: jQuery     : 3.2.1
DEBUG: -------------------------------

Test case

I've put together a simple app for trying out the scenario:
https://github.com/emoryy/emberfire-embedded-model-error
I used ember-cli-dotenv, so put the variables of a test Firebase project into a .env file into the root of the cloned repo like this:

apiKey=xxx
authDomain=xxx
databaseURL=xxx
projectId=xxx
storageBucket=xxx
messagingSenderId=xxx

I didn't put authentication handling into the app, so the database needs to be publicly writable.

To run the app:
npm install && bower install && ember s
or
yarn && bower install && ember s

In the test app there are models named Parent, Child, GrandChild.
Child is embedded into Parent, GrandChild is embedded into Child with hasMany relationships

The app provides buttons to create/remove the above models, and a save button that calls save on all Parent models.

Steps to reproduce

In the test app:

  1. Add Parent models
  2. Add Child models
  3. Add GrandChild models
  4. Press save
  5. Add some more GrandChild models (or remove some)
  6. Press Save
  7. Reload the page

Expected behavior

The modifications performed regarding GrandChild models in step 5 should be seen after saving and reloading the page.

Actual behavior

The modifications performed regarding GrandChild models in step 5 can't be seen after saving and reloading the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant