Commit 588bfeefe36f73792935e70a42db416f2a0d838c
fixed flush
wanderer committed on 3/22/2018, 11:56:28 PMParent: 1fc94adc199518c16723617727d7d19d75724d5b
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -15,11 +15,10 @@ | ||
15 | 15 | * @param opts.dag {object} an instance if [ipfs.dag](https://github.com/ipfs/js-ipfs#dag). If there is no `opts.graph` this will be used to create a new graph instance. |
16 | 16 | * @param opts.decoder {object} a cbor decoder |
17 | 17 | */ |
18 | 18 | constructor (opts) { |
19 | - this._root = opts.root || { | |
20 | - '/': RadixTree.emptyTreeState | |
21 | - } | |
19 | + this._root = {} | |
20 | + this.root = opts.root || RadixTree.emptyTreeState | |
22 | 21 | |
23 | 22 | this.dag = opts.dag || new DataStore(opts.db, opts.decoder) |
24 | 23 | this.graph = opts.graph || new Graph(this.dag) |
25 | 24 | this._setting = Promise.resolve() |
@@ -233,9 +232,10 @@ | ||
233 | 232 | * @returns {Promise} |
234 | 233 | */ |
235 | 234 | async flush () { |
236 | 235 | await this.done() |
237 | - return this.graph.flush(this._root) | |
236 | + await this.graph.flush(this._root) | |
237 | + return this.root | |
238 | 238 | } |
239 | 239 | |
240 | 240 | formatKey (key) { |
241 | 241 | key = RadixTree.formatKey(key) |
Built with git-ssb-web