Skip to content
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

ui.queryArguments: update state less aggressively #6818

Merged
merged 2 commits into from
Jul 19, 2016

Conversation

mcsf
Copy link
Member

@mcsf mcsf commented Jul 15, 2016

To implement once #6417 is merged.

Every time ROUTE_SET is dispatched, the ui.queryArguments.current branch updates itself regardless of whether there is any change in the query data. This potentially leads to unnecessary renders in the view layer or recalculations in memoized selectors.

Test live: https://calypso.live/?branch=update/ui-query-arguments-overwrites

@mcsf mcsf force-pushed the update/ui-query-arguments-overwrites branch from 14a1799 to 458c9e4 Compare July 18, 2016 16:23
@mcsf mcsf added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jul 18, 2016
@lsinger
Copy link
Contributor

lsinger commented Jul 19, 2016

Code is on fleek.

Are we certain that we won't ever need the timestamp when querying these events?

@mcsf
Copy link
Member Author

mcsf commented Jul 19, 2016

Are we certain that we won't ever need the timestamp when querying these events?

Are you referring to the test in isEqualQuery, or to the fact that this excludes any timestamp=foo query argument? For the former: with this change, we assert that we don't care about the last time a ROUTE_SET action was dispatch, but only the last time different arguments were provided in a ROUTE_SET. For the latter: we could also rename this special value timestamp to _timestamp.

@ehg
Copy link
Member

ehg commented Jul 19, 2016

or to the fact that this excludes any timestamp=foo query argument?

Ooh, that passed me right by. _timestamp sounds sensible, and could save someone a headache later :)

@lsinger
Copy link
Contributor

lsinger commented Jul 19, 2016

I meant the former ... but thinking about it again I realize that it will definitely update when a different route is visited. So I'm good on that front.

Good call with making an actual timestamp argument problematic -- rename to _timestamp sounds sensible!

@mcsf
Copy link
Member Author

mcsf commented Jul 19, 2016

I've underscore-prefixed timestamp in b344826. It's probably easier to make this change now rather than later. I notice that it can be confusing to read _timestamp (from ui.queryArguments.*) alongside timestamp (from preferences's guided-tours-history), but it's probably a lesser evil?

@ehg
Copy link
Member

ehg commented Jul 19, 2016

LGTM

@mcsf mcsf merged commit 1c807a8 into master Jul 19, 2016
@mcsf mcsf deleted the update/ui-query-arguments-overwrites branch July 19, 2016 17:38
@mcsf mcsf removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 19, 2016
@mcsf
Copy link
Member Author

mcsf commented Jul 19, 2016

Forgot to squash. D'oh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants