-
Notifications
You must be signed in to change notification settings - Fork 1
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
bug: capabilities.assignRole() should update existing role #413
Comments
Do you have a clear idea of where this happens? I figured it would be in the Seems like to avoid re-implementing sync code, I would have to do the sync-waiting outside of the capabilities instance i.e. in the relevant // in member-api.js
async assignRole(deviceId, roleId) {
await this.#waitForSync()
return this.#capabilities.assignRole(deviceId, roleId)
} where // in mapeo-project.js
this.#memberApi = new MemberApi({
waitForSync: async () => {
await this.#syncApi.waitForSync('initial')
},
// all of the other stuff...
}) This is all based on my early implementation explorations - there may be something I'm missing that's not clear to me at the moment |
Another question: should we also wait for sync and indexing to finish when fetching the capabilities to ensure that we have up-to-date information? again, not sure where this lives e.g. does it live in |
I'm re-thinking this, and think I might have been overthinking before. The datastore/type implementation already waits for indexing, so I think that's enough. I don't think there is really a way to "wait for sync" in a meaningful way when assigning roles. |
yeah i figured the indexing question was less uncertain - just the syncing part had me wondering. if we don't need to add something specific for that, hopefully changing this is straightforward then! |
Description
capabilities.assignRole()
currently just creates a role record, it does not update an existing role. We currently only use it for the initial assignment of a role when inviting a device, but we should:This is probably best done as part of a PR to add
member.assignRole()
to expose this method to the public API, so that we can test it in e2e tests.The text was updated successfully, but these errors were encountered: