yapplabs / ember-buffered-proxy

An Ember Proxy the enables change buffering
MIT License
166 stars 31 forks source link

Prevent buffering of type changes #56

Open kboucher opened 4 years ago

kboucher commented 4 years ago

Relying on ember-buffered-proxy to detect model changes has the drawback that comparisons are strict, and therefore a simple type change is captured by the buffer.

When using an HTML input to edit the value of a model property that is defined as a number, the value is returned from the input as a string. This results in hasChanges being true, when in fact the value has not changed, only the type has changed.

Ember serializers will convert this value back to a number based on the model definition when posted to the server, but the buffer recognizing this as a change means it cannot be relied upon for something like enabling/disabling a Save button in a form.

I'm not sure whether the solution would be to do only value comparisons in ember-buffered-proxy or to support a flag that would allow value only comparisons.