Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: pubSub don't init data if error, creating speculative objcts #19

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pubSub/pubSub.Model.coffee
Expand Up @@ -112,7 +112,7 @@ module.exports =
out.push @at root, true

@_fetch newTargets, (err, data) =>
@_initSubData data
@_initSubData data unless err
callback err, out...

subscribe: (targets...) ->
Expand Down
7 changes: 5 additions & 2 deletions src/util/speculative.coffee
@@ -1,4 +1,4 @@
{merge} = util = require './index'
{merge, deepCopy} = util = require './index'

util.speculative = module.exports =

Expand All @@ -21,7 +21,10 @@ util.speculative = module.exports =
obj.$spec = true
return obj

return Object.create proto, $spec: value: true
obj = deepCopy(proto)
obj.__proto__ = proto
obj.$spec = true
return obj

clone: (proto) ->
if Array.isArray proto
Expand Down