marcuswestin / store.js

Cross-browser storage for all use cases, used across the web.
MIT License
14.01k stars 1.33k forks source link

Error: No supported storage has been added! Add one (e.g store.createStore(require('store/storages/cookieStorage')) #239

Closed sahiljain112 closed 7 years ago

sahiljain112 commented 7 years ago
import store from 'store';
const set = (key, value) => store.set(key, value); 
const get = key => store.get(key);

This is my code. The version I'm using is v2.0.9. I checked the source code and it shouldn't give me that error since the storage array is being imported from storage/all. Why am I getting this error?

marcuswestin commented 7 years ago

Can you check store.version please? On Tue, Jun 20, 2017 at 2:59 AM Sahil Jain notifications@github.com wrote:

import store from 'store'; const set = (key, value) => store.set(key, value); const get = key => store.get(key);

This is my code. The version I'm using is v2.0.9. I checked the source code and it shouldn't give me that error since the storage array is being imported from storage/all. Why am I getting this error?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/marcuswestin/store.js/issues/239, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIDf9c8dpYJB2IyRy8AhsmZYv57nqJSks5sF23lgaJpZM4N_KUQ .

marcuswestin commented 7 years ago

Hey @sahiljain112,

I added a test for this issue (https://github.com/marcuswestin/store.js/blob/master/tests/bugs/gh-239.js). It's currently passing under v2.0.9. Can you double check and help me create a repro please?

dyegolara commented 7 years ago

Yeah, we had the same issue yesterday, updated our dependencies and everything broke when updated to v2.0.8. On v2.0.4 everything was fine, I think it was on 2.0.5 or 2.0.6 where things got strange.

It happens on Safari, Firefox, Chrome and Chromium in both Linux and Mac in at least 3 different machines in our company

I was going to submit the same issue yesterday but I'm glad someone else did.

If you need something from me to help you fix this issue, ill do it happly.

marcuswestin commented 7 years ago

@dyegolara I've merged a few additional PRs and added a few small features. Current version is 2.0.11. Can you please verify that the latest version is broken for you, and if so help me figure out how to reproduce your issue? Currently all out tests are passing on all browsers.

marcuswestin commented 7 years ago

I'm still unable to repro. v2.0.9, v2.0.10 and v2.0.11 all work as expected for me:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<script type="text/javascript" src="https://unpkg.com/store@2.0.9/dist/store.legacy.min.js"></script>
<script type="text/javascript">
    store.set('foo', 'bar')
    console.log(store.get('foo'))
</script>
</body>
</html>

@sahiljain112 @dyegolara Please help me figure out how to reproduce your issue.

dyegolara commented 7 years ago

Just did the update to 2.0.11, everything works fine!!

Thanks man, you have an awesome library, very useful for a lot of users and companies, you have made the web a better place. Keep being cool!

marcuswestin commented 7 years ago

👍 Thanks @dyegolara :)

sahiljain112 commented 7 years ago

Hey @marcuswestin . Everything is working as expected in v2.0.9. I triggered a build with v2.0.8 for which this error was displayed. Thanks for the help!