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

Opening a Scuttlebucket doesn't allow modification of sub-scuttles #14

Open
nrw opened this issue Mar 7, 2014 · 4 comments
Open

Opening a Scuttlebucket doesn't allow modification of sub-scuttles #14

nrw opened this issue Mar 7, 2014 · 4 comments

Comments

@nrw
Copy link

nrw commented Mar 7, 2014

A really simple example lives here: https://github.com/nrw/bucket-example

The problem seems to be that this.parts is undefined in Scuttlebucket.prototype.applyUpdate (here). Are we losing the proper this binding somewhere?

I should note that this test passes if you take out the level-scuttlebutt parts, so I'm reasonably sure the problem is in this module.

@nrw
Copy link
Author

nrw commented Mar 7, 2014

Moving this line in scuttlebutt to be after line 217 fixes this issue, but makes 7 scuttlebutt tests fail (in clone.js and integrate2.js). The comment "really, this should happen before emitting" on line 214 makes me think I'm on the right track, no?

@kumavis
Copy link

kumavis commented Dec 8, 2014

so it seems like level-scuttlebutt makes a clone of the ScuttleBucket via the standard Scuttlebutt.clone() but that does not handle sync'd adding of parts.

@kumavis
Copy link

kumavis commented Dec 8, 2014

My guess is that you need to add all the parts here:

// open document from db
  LevelScuttlebutt(db, Udid('scuttlebuddies'), function() {
    return new ScuttleBucket()
      .add('meta', new Model())
      .add('chat', new Chat())
      .add('text', new Text())
  })
  db.open('default', callback)

@kumavis
Copy link

kumavis commented Dec 8, 2014

@nrw So I made a thing so you can add subdocs anytime:
https://github.com/kumavis/scuttleboat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants