canjs / can-map-backup

Backup and restore a Maps state
https://v3.canjs.com/doc/can-map-backup.html
MIT License
2 stars 1 forks source link

_backupStore not initialized when a can.Map attribute is a can.List #2

Open justinbmeyer opened 8 years ago

justinbmeyer commented 8 years ago

From: https://github.com/canjs/canjs/issues/2194

Hi,

I had an issue with the backup plugin for can.Map. When an attribute of a can.Map is type of can.List and you call method backup for this attribute the _backupStore is not initialized.

See http://jsbin.com/catesenufu/edit?html,css,js,console,output

I have fixed it for me by initializing the backup store before the attributes set to it.

File: backup.js Line: 33ff

backup: function () { if (!this._backupStore) this._backupStore = can.compute(); this._backupStore(this.attr()); return this; }

Best regards Sebastian