I'd like to pin things in the browser's localStorage for faster retrieval the next time a user visits my site, but can't seem to get pinned items to persist even soft reloads.
Steps to reproduce the error:
Open the following html file in your browser and check out the console.
It should have an empty pin list, then cat and pin a file, and then have a nonempty pin list.
Turn off WiFi, close the inspector, and do a soft refresh of the page.
Expected behavior: still able to cat the file.
Actual behavior: Pin list shows up as Array(0) instead of default after hard refresh ([]), can't cat the file.
I don't think it's persisting even without disconnecting from WiFi but that's harder to show.
Am I doing something wrong or is this a bug?
<!doctype html><html><head><scriptsrc="https://unpkg.com/ipfs/dist/index.js"></script></head><body><scripttype="text/javascript">varIPFS=newwindow.Ipfs({repo: String(Math.random()+Date.now()),})IPFS.on('ready',()=>{IPFS.pin.ls().then((pins)=>{console.log('pins on page load')console.log(pins)IPFS.cat('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP',(err,data)=>{if(err){returnconsole.error('ipfs cat error',err)}console.log('cat success! file says: '+data.toString('utf8'))IPFS.pin.ls().then((pins)=>{console.log('pins after cat (should be unchanged)')console.log(pins)IPFS.pin.add('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP').then((resp)=>{console.log('"pin.add" response')console.log(resp)IPFS.pin.ls().then((pins)=>{console.log('pins after add')console.log(pins)})})})})})})</script></body></html>
The text was updated successfully, but these errors were encountered:
npfoss commentedMay 12, 2019
Type: Bug/Question
Severity: Medium?
Description:
I'd like to pin things in the browser's localStorage for faster retrieval the next time a user visits my site, but can't seem to get pinned items to persist even soft reloads.
Steps to reproduce the error:
Open the following html file in your browser and check out the console.
It should have an empty pin list, then
catandpina file, and then have a nonempty pin list.Turn off WiFi, close the inspector, and do a soft refresh of the page.
catthe file.Array(0)instead of default after hard refresh ([]), can'tcatthe file.I don't think it's persisting even without disconnecting from WiFi but that's harder to show.
Am I doing something wrong or is this a bug?
The text was updated successfully, but these errors were encountered: