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.

jsonapi-serializer freezes the browser when nested include is used

See original GitHub issue

jsonapi-serializer 3.0.1

The resources I include: calendar_event, space,host.profile

new Deserializer({keyForAttribute: 'snake_case'}).deserialize(input, (err, resource) => {
          console.log(resource);
          onSuccess(response, resource);
        });

Here is the input:

{
  "data": {
    "id": "524",
    "type": "events",
    "attributes": {
      "name": "Omnis labore laboriosam magni qui.",
      "status": "pending",
      "cost_cents": 7577,
      "description": "perferendis molestiae voluptatem",
      "is_public": true,
      "bartender": false
    },
    "relationships": {
      "calendar_event": {
        "data": {
          "id": "424",
          "type": "calendar_events"
        }
      },
      "host": {
        "data": {
          "id": "1",
          "type": "users"
        }
      },
      "space": {
        "data": {
          "id": "1",
          "type": "spaces"
        }
      }
    }
  },
  "included": [
    {
      "id": "424",
      "type": "calendar_events",
      "attributes": {
        "title": "Booking",
        "availability": "busy",
        "starts_at": "2016-03-25T06:30:00.000Z",
        "ends_at": "2016-03-25T13:30:00.000Z",
        "ical_schedule": null
      },
      "relationships": {
        "resource": {
          "data": {
            "id": "524",
            "type": "events"
          }
        }
      }
    },
    {
      "id": "1",
      "type": "users",
      "attributes": {
        "email": "my@email.com",
        "roles": []
      },
      "relationships": {
        "profile": {
          "data": {
            "id": "1",
            "type": "profiles"
          }
        }
      }
    },
    {
      "id": "1",
      "type": "profiles",
      "attributes": {
        "first_name": "Anton",
        "last_name": "Anton",
        "birthday": "1905-12-10",
        "avatar_original_url": "aha!",
        "avatar_thumb_url": "aha!",
        "bio": null,
        "phone": "aha!",
        "address_line_1": "aha!",
        "address_line_2": null,
        "city": "aha!",
        "state": "aha!",
        "postcode": "aha!",
        "country_code": null
      },
      "relationships": {
        "user": {
          "data": {
            "id": "1",
            "type": "users"
          }
        }
      }
    },
    {
      "id": "1",
      "type": "spaces",
      "attributes": {
        "name": "Space #1",
        "from_people": 1,
        "to_people": 10,
        "picture_original_url": "aha!",
        "picture_thumb_url": "aha!",
        "picture_thumb_2x_url": "aha!",
        "credits_per_slot": 10
      }
    }
  ]
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zweckcommented, Apr 3, 2017

Hi @SeyZ I’ve dropped v3.4.3 into my project and it’s all good 😃 thanks 👍

1reaction
itsravenouscommented, Apr 3, 2017

Thanks @SeyZ!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deep nested serialization, preferably without JSONAPI spec
Since upgrading to the latest gem version however, my deep nested associations are not rendering as json. For example, look at projects and ......
Read more >
nested loop takes too long and almost crashes the browser
Since you are just looping through an array you can split that up into different parts and use timers to process each ...
Read more >
@ember-data/model | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Accessing relationship data with JSON: API serializer
There are two ways to display attributes for any has_many or belongs_to relationships using JSON:API serializer. Deeply nested.
Read more >
JS libraries | Everything I know - My Knowledge Wiki
normalizr - Normalizes nested JSON according to a schema. FBJS - Collection of utility libraries used by other Facebook JS projects. Uppy -...
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