-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Browser: Reloading page with static repoName throws error #773
Comments
This is somewhat expected, but I agree the api is currently not easy to understand.
What to do:
|
Thanks! I will try |
@dignifiedquire that worked. How can I help getting it exposed and documented? |
How about exposing it to the main ipfs.repoExists(callback) |
We kind of mimicked the behaviour of go-ipfs in this one, but I can the value of having a direct call to check for a boolean instead of checking for an error. There is already a repoExists available at https://github.com/ipfs/js-ipfs/blob/master/src/core/utils.js#L3-L15 that is used by https://github.com/ipfs/js-ipfs/blob/master/src/core/components/repo.js#L11-L24. I see three ways we can have this done:
In reality, you are just checking if there something in that path and not validating its contents, so that is space to improve there as well. |
Thanks @diasdavid I've started the work here: #776. Let me know which direction I should take it and I'll be happy to finish the work. |
@aphelionz gave you my feedback there. Will close this issue, let's continue the discussion of this feature there. Thank you for contributing! :) |
Steps to reproduce:
Run this code in the browser to connect to a repo with a static name. In this case "pastebin"
Expected Behavior: console should log "good to go" every time
Actual Behavior: the console logs "good to go" the first time, and throws the error the second time
This is related to IndexedDB. It seems ipfs.init doesn't like existing repos.
It also seems that emptyRepo has no effect, as this error occurs when it is true or false. Upon further inspection emptyRepo is used to "seed" the database with the initial blocks.
The text was updated successfully, but these errors were encountered: