Wp-calypso: Framework: Redux single data tree and query components

Created on 27 Apr 2016  路  8Comments  路  Source: Automattic/wp-calypso

To make further progress in offline support it's imperative we consolidate our historical data approaches under the same redux state tree. Read Our Approach to Data.

Action items

In general we need to move data from Flux stores and older -list type structures into the single redux state tree. That means porting over the actions and selectors as well as creating relevant query-components.

  • [ ] Remove store module dependency.
  • [ ] Move Query components to a folder at the root of client.

Sites

  • [ ] Add actions for fetching and receiving whole list of sites.
  • [x] Add schema for sites.
  • [ ] Move "recentlySelected" sites to state tree.
  • [x] Move selectors.
  • [x] Create QuerySites. #5066
  • [x] Create QuerySiteDomains #4972
  • [ ] Remove sitesList.fetch() instances.
  • [ ] Move cases of sitesList.getSelectedSite() to getSelectedSite( state ). #8726
  • [ ] Switch to querying via state actions in controllers.
  • [x] Replace site.fetchSettings and site.saveSettings with corresponding Redux Actions / Selectors / Reducer and QuerySiteSettings Component. #9056

Jetpack Sites

  • [ ] Create QueryUpdates component.
  • [ ] Dismantle JetpackSite.prototype. Add query components, actions, selectors and reducers for:

    • [x] isModuleActive

    • [ ] verifyModulesActive

    • [x] getRemoteManagementURL

    • [ ] handleError

    • [ ] updateWordPress

    • [ ] callHome

    • [x] activateModule - removed in #13029.

    • [x] deactivateModule - removed in #13029

    • [ ] toggleModule

    • [ ] fetchMonitorSettings

    • [ ] updateMonitorSettings

    • [ ] updateSshCredentials

    • [x] toggleSshScan - removed in #13029

    • [x] fetchSshCredentials - removed in #13029

    • [x] updateSshCredentials - removed in #13029

    • [ ] getOption

    • [ ] setOption

    • [x] fetchJetpackKeys - removed in #13029

  • [ ] Move logic to server side

    • [ ] updateComputedAttributes
    • [ ] canManage
    • [ ] isSecondaryNetworkSite
    • [ ] isMainNetworkSite

      User

  • [ ] Move "user" data to redux and remove localStorage dependency.

  • [x] Add schema for current user. #3356
  • [ ] Move user settings data to redux #7927

    Posts

  • [ ] Move "posts" data to redux. #2248 #2350#3487

  • [x] Add all-posts selectors and actions.
  • [x] Figure out normalization of post images. #4936
  • [ ] Implement QueryPosts in "/posts" section.
  • [x] Implement QueryPosts in "Drafts list". #4936

    Stats

  • [x] Move "stats" data to redux and remove localStorage dependency. #5743

  • [ ] Create post.stats state sub-tree.

    • [ ] Move Followers List ( Could we share logic with reader here ? ) to stats state sub-tree
    • [x] Move Comments Data to stats state sub-tree
    • [x] Move Followers Data to stats state sub-tree
    • [x] Move Posts & Pages Data to stats state sub-tree
    • [x] Move Countries Data to stats state sub-tree
    • [x] Move Referrers Data to stats state sub-tree
    • [x] Move Search Terms Data to stats state sub-tree
    • [x] Move Clicks Data to stats state sub-tree
    • [x] Move Authors Data to stats state sub-tree
    • [x] Move Chart Data to stats state sub-tree
    • [x] Move Video Data to stats state sub-tree #10520

      Editor (Needs Issue)

  • [ ] Move "editor" to redux. #2993

  • [ ] Move "media list" data to redux.
  • [ ] Move embed data to redux #7924
  • [x] Move shortcode data to redux. #8116
  • [ ] Create QueryMedia component.
  • [ ] Remove MediaListData component.
  • [x] Create QueryPageTemplates component (#7229)
  • [x] Remove PageTemplatesData component (#7229)
  • [x] Move post formats data to redux (#7925, #8402)
  • [x] Create QueryPostFormats component. (#8402)
  • [x] Remove PostFormatsData component. (#8593)
  • [x] Create QueryTags component. Covered by QueryTerms
  • [ ] Remove TagListData component.
  • [ ] Create QueryEmbeds component.
  • [x] Create QueryTerms component (#5500)
  • [ ] Update TinyMCE embed view to use QueryEmbeds.
  • [ ] Remove or update Shortcode component. #8857
  • [x] Create QueryShortcodes component. #8116

    General

  • [x] Move "notices" to redux. #1496

  • [x] Move "preferencesData" data to redux and remove localStorage dependency. #5401
  • [x] Create QueryPreferences component. #5401
  • [x] Remove PreferencesData component. #8295
  • [x] Move "postCounts" to redux. #4217
  • [x] Create QueryPostCounts component.
  • [ ] Remove StoreConnection component.
  • [x] Move screen title to redux. #3796, #7224
  • [ ] Move InfiniteList to redux (Needs Issue)
  • [ ] Move countries list to redux #7920
  • [x] Move states list to redux #7922
  • [x] Move happiness engineers data to redux #7926

    Reader #10984

  • [x] Move "Comments" data to redux.

  • [x] Create QueryComments component.
  • [ ] Move "Stream" data to redux.
  • [x] Move "Posts" data to redux. #5564
  • [x] Refactor normalization. #5577 #5643
  • [x] Add feed and site state to redux. #5396
  • [x] Move user feed subscriptions to Redux.
  • [x] Reduxify Post Likes Store #10361

Sharing

  • [x] Move "publicize" data to redux. #338#2317#3417#736#756
  • [x] Move keyring data to redux. #8729
  • [x] Remove connections-list module. #8991
  • [x] Move services list to redux #7919
  • [x] Remove services-list module #8595
  • [x] Move sharing buttons list to redux #7928

    Themes

  • [ ] Create QueryThemes component.

  • [ ] Remove ThemesListFetcher.
  • [x] Convert CurrentThemeData to QueryTheme or selectors. #5361

    Plans

  • [x] Move "plansList" data to redux and remove localStorage dependency. #5444

  • [x] Add QuerySitePlans component. #4933
  • [ ] Remove plans flux stores.
  • [x] Create QueryPlans component. #5444

    Domains #6144

  • [ ] Create QueryDomains component.

  • [ ] Stop using StoreConnection in domain management.
  • [ ] Remove domains flux stores.

    Purchases

  • [x] Move existing reducer in client/lib/purchases/reducer to client/state/ #6317

  • [x] Move existing actions in client/lib/purchases/actions to client/state/
  • [x] Create QueryPurchases component.
  • [x] Stop using StoreConnection in purchases.
  • [x] Remove purchases flux stores.

    Stored cards

  • [x] Move existing reducer in client/lib/purchases/stored-cards/reducer to client/state/ #6413

  • [ ] Move existing actions in client/lib/purchases/stored-cards/actions to client/state/
  • [ ] Create QueryStoredCards component.
  • [ ] Stop using StoreConnection in purchases.
  • [ ] Remove stored cards flux stores.

    People (Needs Issue)

  • [ ] Move "People" data to redux.

  • [x] Move site roles to redux #7921, #9249
  • [x] Create QueryUsers component #14930
  • [x] Create QueryFollowers component.
  • [ ] Create QueryEmailFollowers component.
  • [ ] Create QueryViewers component

    Plugins https://github.com/Automattic/wp-calypso/issues/8213 #8786

  • [x] Move "Plugins" data to redux. https://github.com/Automattic/wp-calypso/pull/8206

  • [x] Create QueryJetpackPlugins component. https://github.com/Automattic/wp-calypso/pull/8275
  • [ ] Add Plugins selectors and actions.

    SiteVouchers

  • [x] Implement state.sites.vouchers. #5574

  • [x] Create QuerySiteVouchers component. #5579
Framework Maintenance [Pri] High [Type] Enhancement

All 8 comments

  • [ ] Move Query components to a folder at the root of client.

what about ./client/query-components/ ?

Yes, that's probably the best candidate so far, though a bit long.

@mtias Added QueryTerms to the above, also QueryTerms should cover any need for QueryTags as well by using post_tag as the taxonomy type ( i.e. /v1.1/sites/{slug}/taxonomies/post_tag/terms )

I added QueryUsers and QueryViewers to the People section above.

@retrofox can Move "plansList" data to redux and remove localStorage dependency. be ticked off?

@retrofox can Move "plansList" data to redux and remove localStorage dependency. be ticked off?

@scruffian Although we did a PR for this I'm afraid that the issue isn't 100% done. I'll take a look and if it's done I'll close it. If not I'll work on this next week.

@mtias : thanks for the thorough list of action items in moving everything to the redux state tree. I'm trying to get a handle on all the current outstanding or in-progress issues, and make sure we have an accurate list of the remaining tasks to get to the end goal. There are a lot of issues logged (unfortunately lots of them are old or stale).

I've created a project to consolidate all the different work happening here: https://github.com/Automattic/wp-calypso/projects/45

I'll be taking a look at the remaining action items here, and likely will split them out into their own issues so they're easier to track in the project. And I'm guessing their are action items here that are either already complete or have a duplicate issues.

Let me know if you have any concerns or comments.

Closing this one as we're tracking work via the project instead of this PR.

Was this page helpful?
0 / 5 - 0 ratings