-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stats to the global redux store #2310
Conversation
06f900e
to
3a22aa2
Compare
|
||
case 'searchterms': | ||
summaryList = new StatsList( { siteID: siteId, statType: 'statsSearchTerms', period: activeFilter.period, date: endDate, max: 0, domain: site.slug } ); | ||
fetchActions = createFetchActionsForModule( module, activeFilter, endDate, { post: queryOptions.post } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check to see if this post
param applies to both actions... I'm guessing not.
TODO: don't accept the extra params to createFetchActionsForModule
& just explicitly modify the fetch actions here for exceptions.
e2f98e8
to
e02f260
Compare
const params = { | ||
siteID, | ||
statType, | ||
options: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we pass postID
here as well, we can automate this in getStatsItem
& isStatsItemFetching
.
Ideally, we wrap connect
in our own util function statsConnect
(or something) that handles this boilerplate for us in each component.
Initial commit includes a basic action & reducer to get started working with the store.
Now with selectable per-query states for response values & a composite-key-based `isLoading` value
… controller * Hooked up the individual post view (`StatsPostDetail`) to the redux flow by mapping redux state to component props * Removed usage of `StatsList` in `StatsPostDetail` & all child components * Use domain from the URL if the site id is not available * Block actions without a site id or domain (fixes #2400) * Break selectors and utils into their own files * Use deterministic composite keys instead of nested objects as store values
* Hook up most of the countryViews module tree * Generalize modules' connections between statTypes & fetchActions to their `moduleState` prop * Adapt `StatsDownloadCsv` & add util function: `csvData`
|
||
export function getStatsItem( state, params ) { | ||
const _params = normalizeParams( params ); | ||
const key = getCompositeKey( _params ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: try out the deterministic-stringify lib here.
This pull request will need to be updated with the merger of #3773:
|
Needs a refresh still. |
Closing since #5743 was merged |
User Stats State
A module for managing the data which backs a user or site's Stats reporting features.
Action Creators
createFetchActionsForModule
Actions
fetchSiteStats
Reducers
items
fetchingItems
Selectors
getStatsItem
isStatsItemFetching
Utils
getStatsTypesByModule
getCompositeKey
normalizeParams
isDefined
Still
@TODO
:StatsList
:StatsList
This is a work-in-progress and will be filled in as the implementation develops.