Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.42k stars 1.99k forks source link

Get rid of 'store' dependency #26621

Open flootr opened 6 years ago

flootr commented 6 years ago

Follow up on discussion in https://github.com/Automattic/wp-calypso/pull/26045

We use store in some places (see below) to persist data on client side storages (like localStorage) safely across browsers. However, we also use localforage (wrapped in an async api). Both seem to serve the same use case.

Let's iterate on whether we'd want to remove store in favor of localforage. It seems the main difficulty lies in store being used in a synchronous way while localforage is used in an asynchronous way.

// Usage of 'store' (there may be more)

client/auth/controller.js
19:import store from 'store';

client/signup/controller.js
27:import store from 'store';

client/reader/sidebar/promo.jsx
9:import store from 'store';

client/blocks/app-promo/index.jsx
11:import store from 'store';

client/boot/project/wordpress-com.js
8:import store from 'store';

client/layout/masterbar/notifications.jsx
19:import store from 'store';

client/state/posts/actions.js
6:import store from 'store';

client/my-sites/invites/controller.js
6:import store from 'store';

client/lib/preferences/actions.js
8:import store from 'store';

client/lib/oauth-token/index.js
8:import store from 'store';

client/lib/abtest/index.js
9:import store from 'store';

client/lib/desktop/index.js
17:import store from 'store';

client/lib/user/user.js
8:import store from 'store';

client/lib/local-list/index.js
10:import store from 'store';

client/lib/restore-last-path/index.js
9:import store from 'store';

client/my-sites/invites/invite-accept-logged-out/index.jsx
11:import store from 'store';

client/my-sites/stats/checklist-banner/index.jsx
13:import store from 'store';

client/lib/preferences/test/actions.js
6:import store from 'store';

client/lib/wp/handlers/guest-sandbox-ticket.js
8:import store from 'store';

client/lib/wp/handlers/test/guest-sandbox-ticket.js
6:import store from 'store';
tyxla commented 4 years ago

https://github.com/Automattic/wp-calypso/pull/45171 removes one of the store consumers.

github-actions[bot] commented 3 years ago

This issue is stale because it has been 180 days with no activity. You can keep the issue open by adding a comment. If you do, please provide additional context and explain why you’d like it to remain open. You can also close the issue yourself — if you do, please add a brief explanation and apply one of relevant issue close labels.

flootr commented 3 years ago

Still relevant.

tyxla commented 3 years ago

After looking at how lib/user consumes and needs local storage, I think we'll end up needing store more or less for some edge cases. We could refactor to use cookies of course, but I'm not sure it's a worthy improvement.

github-actions[bot] commented 2 years ago

This issue is stale because it has been 180 days with no activity. You can keep the issue open by adding a comment. If you do, please provide additional context and explain why you’d like it to remain open. You can also close the issue yourself — if you do, please add a brief explanation and apply one of relevant issue close labels.