Has anyone tried SAFE DOM safeNfs.update()?

I’m having a problem using safeNfs.update() giving InvalidSuccessor error.

My earlier problem (same error) with safeNfs.delete() was fixed by using the file version + 1 but I’ve tried both file version + 1 and container version + 1 with with safeNfs.update() and not found a way to avoid this error.

So I’m wondering if there is anyone who has successfully used this DOM API and if you have any code examples I can look at? The versions look good to me so I’m wondering if it may be a bug in the API.

You can try it yourself on alpha2 (currently it is using the container version + 1 when my guess is it should be file version, but that also fails with a similar error), but you can see the file and container versions as part of the _getFolder() output in the console.

You need to load the app (safe://qw2) and connect by clicking the SAFE icon (top right). Then click the top left of the ‘note’ to toggle into input mode, enter some text and hit Save, then re-edit and save to trigger the update.

UPDATE: Looks like I’m confusing the file version with the entry value version! So I have not been using the file version at all :blush:.


Still a good question though because we are in need of more examples. Not yet publicised but check out our new tests: https://github.com/maidsafe/safe_browser/blob/master/app/tests/beaker-plugin-safe-app/test_modules/nfs.spec.js#L26


Thanks @hunterlester that code was helpful :slight_smile: