question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ember 3.0 Regression, attribute value not being serialized

See original GitHub issue

This seems like this would be an ember-data issue, but it starts happening only if i change ember-source from 2.18 -> 3.0. If I leave ember-data and ember-cli at 3.0 or 3.1, but have ember source at 2.18, it also works.

Here’s the issue:

You can see that the first line item on the model has blah as the value of notes as save() is being called.

But the payload to the server looks like this: (note notes: "")

{
  "title": "Invoice Title",
  "po_number": "PO-3",
  "currency_code": "USD",
  "notes": "",
  "terms": "",
  "number": "GHANGI-0001",
  "date": "2018-06-30",
  "cloud_files": [],
  "line_items": [
    {
      "name": "test1",
      "notes": "",
      "quantity": 1,
      "rate": 3,
      "type": "time-entry",
      "discount": "0.00",
      "order": 1
    }
  ],
  "account_id": "5",
  "customer_id": "8"
}

Here is my deps:

  "devDependencies": {
    "broccoli-asset-rev": "^2.4.5",
    "ember-ajax": "^3.0.0",
    "ember-cli": "~3.1.3",
    "ember-cli-app-version": "^3.0.0",
    "ember-cli-babel": "^6.6.0",
    "ember-cli-dependency-checker": "^2.0.0",
    "ember-cli-eslint": "^4.2.1",
    "ember-cli-htmlbars": "^2.0.1",
    "ember-cli-htmlbars-inline-precompile": "^1.0.0",
    "ember-cli-inject-live-reload": "^1.4.1",
    "ember-cli-qunit": "^4.1.1",
    "ember-cli-shims": "^1.2.0",
    "ember-cli-sri": "^2.1.0",
    "ember-cli-uglify": "^2.0.0",
    "ember-data": "~3.1.0",
    "ember-export-application-global": "^2.0.0",
    "ember-load-initializers": "^1.0.0",
    "ember-maybe-import-regenerator": "^0.1.6",
    "ember-resolver": "^4.0.0",
    "ember-source": "~3.1.0", // <-------------- change only this to ~2.18.0 and it works again
    "ember-welcome-page": "^3.0.0",
    "eslint-plugin-ember": "^5.0.0",
    "loader.js": "^4.2.3"
  },
  "engines": {
    "node": "^4.5 || 6.* || >= 7.*"
  },

When I look at the model, it looks like ember has rearranged its structure of how it stores data, and I’m wondering if the problem is related to how ember-source gives the data to ember-data, thats why it looks like an ember data problem.

Anything I can do to help debug?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
akshaisarmacommented, May 18, 2018

To elaborate, I did a bit of debugging to see what’s happening and it looks like a stale computed property cache issue when the field is retrieved when a Snapshot object of it is created in Ember Data for serialization. Even though the model has the right values set in _attributes, the computed property finds a stale value in the cache for it. In my case, it only happens after the model is saved once.

2reactions
stephankaagcommented, May 8, 2018

I see this issue in my application as well. Something broke between 2.18 and 3.0.

In my case, I was able to trace it down to a computed-property that depends on the property that is not properly serialized. When I remove the computed-property the issue is solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing Serializers - Ember Data
In Ember Data, serializers format the data sent to and received from the backend store. By default, Ember Data serializes data using the...
Read more >
Ember data changing primaryKey for a model from id to ...
It has a primaryKey being returned from the json api called specialty_id instead of id (what ember data probably expects). So not fiddling...
Read more >
@ember-data/store | Yarn - Package Manager
The lightweight reactive data library for JavaScript applications. Build Status Discord Community Server. Wrangle your application's data management with ...
Read more >
Changelog - Cypress Documentation
Fixed an issue with Angular Component Testing where urls within SASS/SCSS files were not being correctly resolved which could result in incomplete styling....
Read more >
Ember 4.3 Has Been Released - Morioh
As with type objects, type transformers are only responsible for serializing values. They should be used when you need to serialize a value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found