ZiadJ / knockoutjs-reactor

Recursively tracks changes within a view model no matter how deeply nested the observables are or whether they are nested within dynamically created array elements.
Other
74 stars 22 forks source link

hide option still watching #11

Closed shri3k closed 9 years ago

shri3k commented 10 years ago

Hi, In the readme it's mentioned that, to unwatch any observable we can simply pass {hide: path.of.observable} as an option. But when I do this it still watches for the item I specified in the hide option. Not sure if I'm doing this right but here's a rough fiddle which I put together to check the hide option.

Thanks for the plugin. Really impressed by how much it does with such little code. :+1:

ZiadJ commented 10 years ago

We've got a bug here...thanks for catching it! I'll fix it in the next update but for now you can get around it by replacing

typeof options.hide === 'object'

with

Object.prototype.toString.call(options.hide) !== '[object Array]'

However I recommend you use {hide: [ path.of.observable ]} to be on the safe side. That's because I might drop support for the non-array reference for consistency. I don't think anyone could be affected by this "breaking" change since it was already broken anyway and for quite some time.

You're welcome.

shri3k commented 10 years ago

Awesome. Thanks for the temp solution. I'll make sure of the array change in the future.

ZiadJ commented 9 years ago

Fixed in the latest beta version.