-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1880 from nextstrain/james/improve-tree-perf
Improve tree performance for trees with over 4000 tips
- Loading branch information
Showing
7 changed files
with
49 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as types from "../actions/types"; | ||
|
||
/** | ||
* Performance flags (reduxState.controls.performanceFlags) represent flags | ||
* for which we enable/disable certain functionality in Auspice. These flags | ||
* shouldn't be depended on, i.e. Auspice should work just fine without them | ||
* (but may be a little slow). | ||
*/ | ||
|
||
|
||
export const performanceFlags = (_store) => (next) => (action) => { | ||
let modifiedAction; | ||
switch (action.type) { | ||
case types.URL_QUERY_CHANGE_WITH_COMPUTED_STATE: /* fallthrough */ | ||
case types.CLEAN_START: { | ||
modifiedAction = {...action}; | ||
modifiedAction.controls.performanceFlags = calculate(action) | ||
} | ||
} | ||
return next(modifiedAction || action); // send action to other middleware / reducers | ||
}; | ||
|
||
function calculate({tree}) { | ||
const flags = new Map(); | ||
const totalTipCount = tree?.nodes?.[0]?.fullTipCount; | ||
flags.set("skipTreeAnimation", totalTipCount > 4000); | ||
return flags; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters