Skip to content

Instantly share code, notes, and snippets.

View beaucollins's full-sized avatar
🃏
Special Author

Beau Collins beaucollins

🃏
Special Author
View GitHub Profile
diff --git a/src/components/block-graph/index.js b/src/components/block-graph/index.js
index 7d253fc1..df0fc5da 100644
--- a/src/components/block-graph/index.js
+++ b/src/components/block-graph/index.js
@@ -68,12 +68,45 @@ export type Rectangle = {
height: number,
};
+type RectDep = {
+ top: number,
+------------+-------------------------+--------+-----+---------+-----------------------+-----------------------+-----------+
| date | timezone | offset | day | user_id | name | setting | available |
+------------+-------------------------+--------+-----+---------+-----------------------+-----------------------+-----------+
| 2018-11-01 | America/New_York | -04:00 | Thu | 411 | Dustin Hartzler | | 0 |
| 2018-11-01 | America/Chicago | -05:00 | Thu | 448 | Shaun Kuschel | DAY_TYPE_WORK_DAY | 0 |
| 2018-11-01 | Africa/Johannesburg | +02:00 | Thu | 451 | Job Thomas | DAY_TYPE_WORK_DAY | 0 |
| 2018-11-01 | Europe/Madrid | +01:00 | Thu | 457 | Valentina Thörner | DAY_TYPE_WORK_DAY | 0 |
| 2018-11-01 | America/Chicago | -05:00 | Thu | 461 | Erica Kuschel | DAY_TYPE_WORK_DAY | 3 |
| 2018-11-01 | A
diff --git a/client/lib/tree-select/package.json b/client/lib/tree-select/package.json
new file mode 100644
index 0000000000..960bdf7509
--- /dev/null
+++ b/client/lib/tree-select/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "@automattic/tree-select",
+ "version": "1.0.0-rc1",
+ "description": "This module exports a function which creates a cached state selector for use with the Redux global application state. It is a good idea to use this function over plain selectors whenever either the computation over state or React's rerenders are expensive. It is called `treeSelect` because it internally uses a tree of dependencies to allow the gc to free memory without explicitly clearing the cache.",
/** @format */
/**
* External dependencies
*/
import { isObject, some, isFunction } from 'lodash';
const defaultGetCacheKey = (...args) => args.join();
/**
diff --git a/src/lib/tree-select/index.js.flow b/src/lib/tree-select/index.js.flow
index 7bfb4bdf..589679c8 100644
--- a/src/lib/tree-select/index.js.flow
+++ b/src/lib/tree-select/index.js.flow
@@ -16,7 +16,7 @@
* returns an array of values to be used in the Computation as well
* as the values used by the caching/memoization layer.
*/
-type DependentsSelector<S, D> = S => D;
+type DependentsSelector<S, O, D> = (S, ...O) => D;
diff --git a/src/lib/tree-select/index.js.flow b/src/lib/tree-select/index.js.flow
index 589679c8..d85db2fb 100644
--- a/src/lib/tree-select/index.js.flow
+++ b/src/lib/tree-select/index.js.flow
@@ -35,6 +35,15 @@ type Computation<D, R, O> = (D, ...O) => R;
*/
type CachedSelector<S, R, O> = (S, ...O) => R;
+/**
+ * Configuration optios for treeSelect. Currently a single key
[wpcom] commands $ wp happytools scheduler organization get "Automattic"
+--------------------+------------+-------------+------------+------------+------------+
| hs_organization_id | name | preferences | created_at | updated_at | is_deleted |
+--------------------+------------+-------------+------------+------------+------------+
| 1 | Automattic | | 1542792183 | 1542792183 | |
+--------------------+------------+-------------+------------+------------+------------+
Projects
+---------------+---------------+-------------+-----------------+-------------+-------------+-------------+
| hs_project_id | name | preferences | organization_id | is_archived | archived_by | archived_on |
+---------------+---------------+-------------+-----------------+-------------+-------------+-------------+
middleware/utils
after
✓ matches
✓ ignores
dispatchAfter
✓ dispatches
✓ ignores
many
✓ reacts to jump
✓ reacts to rattle
export default many(
notify(isTaskTypeCreate, "The project's task type was successfully created.", "The project's task type could not be created."),
notify(isTaskTypeUpdate, "The project's task type was successfully updated.", "The project's task type could not be updated."),
notify(isProjectsCreate, 'Project successfully created.', 'Project could not be created.'),
notify(isProjectsUpdate, 'Project successfully updated', 'Project could not be updated.'),
notify(isTeamsCreate, 'Team successfully created.', 'Team could not be created.'),
notify(isTeamsUpdate, 'Team successfully updated.', 'Team could not be updated.'),
notify(isUsersCreate, 'User successfully created.', 'User could not be created.'),
notify(isUsersUpdate, 'User successfully updated.', 'User could not be updated.'),
);
export default function({ dispatch }: MiddlewareAPI<AppState, ActionTypes, Dispatch<ActionTypes>>) {
return (next: Dispatch<ActionTypes>) => async (action: ActionTypes): any => {
next(action);
switch (action.type) {
case 'PROJECTS_TASK_TYPES_CREATE':
if (action.stage.type === REQUEST_STAGE_SUCCESS) {
dispatch(
createTemporaryNotice('is-success', "The project's task type was successfully created.")
);