backbone.js - How to best make Backbone play nice with GUIDs? -


i have client-side application written backbonejs. pulls data server. domain objects on server identify guids.

in backbone, if model's id not set "null" "isnew" returns false. so, can't initialize model's id guid.empty (instead of null) without side-effects.

when fetch data server - response has ids values of guid.empty. backbone automatically parses server's response , triggers onchange events properties change "null" guid.empty.

i'm wondering if has experience in handling , right way go resolving is. should guids nullable? override isnew() method , account guid.empty? stifle onchange events on given conditions?

as understand, guid.empty means no id , it's convention naming? suggest implement parse method , change guid.empty null in incoming objects. looks me more natural keep null objects in js null, not backend represents it.


Comments