ember-custom-actions icon indicating copy to clipboard operation
ember-custom-actions copied to clipboard

pushToStore Array vs Object Mismatch

Open CharlesKozel opened this issue 7 years ago • 0 comments

Code Block I'm Referencing

In the _onSuccess handler, when pushToStore is true, this._validResponse(response) ensures the response is an object with > 0 keys. However later on when this.get('serializer').normalizeArrayResponse is called with response as the payload.

normalizeArrayResponse's payload is expected to be an array, when previously is was required to be an object. With the standard JsonSerializer it errors with an object is provided, and does not go into this block when an array is provided as the response.

Is normalizeArrayResponse intended to be normalizeSingleResponse? Which would make more sense to me when operating on a single record, I would think custom actions would usually return an updated version of that object.

Maybe it should check the type and normalize as a SingleResponse or an ArrayResponse based on type, so custom search actions can still return an array.

CharlesKozel avatar Nov 01 '18 23:11 CharlesKozel