mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-07 09:28:12 +08:00
run prettier(2.0.5) (#1438)
This commit is contained in:
@@ -49,7 +49,7 @@ const skipOnActions = new Set([
|
||||
"annotation: disable category edit mode",
|
||||
"annotation: activate edit label mode",
|
||||
"annotation: cancel edit label mode",
|
||||
"set annotations collection name"
|
||||
"set annotations collection name",
|
||||
]);
|
||||
|
||||
/*
|
||||
@@ -101,7 +101,7 @@ const saveOnActions = new Set([
|
||||
"annotation: label edited",
|
||||
"annotation: label current cell selection",
|
||||
"annotation: delete label",
|
||||
"annotation: category edited"
|
||||
"annotation: category edited",
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -115,26 +115,26 @@ See graph definition for the transitions that use each.
|
||||
|
||||
Signature: (fsm, transition, reducerState, reducerAction) => undoableAction
|
||||
*/
|
||||
const stashPending = fsm => ({
|
||||
const stashPending = (fsm) => ({
|
||||
[actionKey]: "stashPending",
|
||||
[stateKey]: { fsm }
|
||||
[stateKey]: { fsm },
|
||||
});
|
||||
const cancelPending = () => ({
|
||||
[actionKey]: "cancelPending",
|
||||
[stateKey]: { fsm: null }
|
||||
[stateKey]: { fsm: null },
|
||||
});
|
||||
const applyPending = () => ({
|
||||
[actionKey]: "applyPending",
|
||||
[stateKey]: { fsm: null }
|
||||
[stateKey]: { fsm: null },
|
||||
});
|
||||
const skip = (fsm, transition) => ({
|
||||
[actionKey]: "skip",
|
||||
[stateKey]: { fsm: transition.to !== "done" ? fsm : null }
|
||||
[stateKey]: { fsm: transition.to !== "done" ? fsm : null },
|
||||
});
|
||||
const clear = () => ({ [actionKey]: "clear", [stateKey]: { fsm: null } });
|
||||
const save = (fsm, transition) => ({
|
||||
[actionKey]: "save",
|
||||
[stateKey]: { fsm: transition.to !== "done" ? fsm : null }
|
||||
[stateKey]: { fsm: transition.to !== "done" ? fsm : null },
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -171,11 +171,11 @@ Basic approach:
|
||||
* only implement complex state machines where absolutely required (eg,
|
||||
multi-event seleciton and the like)
|
||||
*/
|
||||
const actionFilter = debug => (state, action, prevFilterState) => {
|
||||
const actionFilter = (debug) => (state, action, prevFilterState) => {
|
||||
const actionType = action.type;
|
||||
const filterState = {
|
||||
...prevFilterState,
|
||||
prevAction: action
|
||||
prevAction: action,
|
||||
};
|
||||
if (skipOnActions.has(actionType)) {
|
||||
return { [actionKey]: "skip", [stateKey]: filterState };
|
||||
@@ -246,7 +246,7 @@ const debug = false;
|
||||
const undoableConfig = {
|
||||
debug,
|
||||
historyLimit: 50, // maximum history size
|
||||
actionFilter: actionFilter(debug)
|
||||
actionFilter: actionFilter(debug),
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -258,9 +258,9 @@ if (debug) {
|
||||
Confirm no intersection between the various trivial rejection action filters
|
||||
*/
|
||||
if (
|
||||
new Set([...skipOnActions].filter(x => clearOnActions.has(x))).size > 0 ||
|
||||
new Set([...skipOnActions].filter(x => saveOnActions.has(x))).size > 0 ||
|
||||
new Set([...clearOnActions].filter(x => saveOnActions.has(x))).size > 0
|
||||
new Set([...skipOnActions].filter((x) => clearOnActions.has(x))).size > 0 ||
|
||||
new Set([...skipOnActions].filter((x) => saveOnActions.has(x))).size > 0 ||
|
||||
new Set([...clearOnActions].filter((x) => saveOnActions.has(x))).size > 0
|
||||
) {
|
||||
console.error(
|
||||
"Undoable misconfiguration - action filters have redundant events"
|
||||
@@ -275,10 +275,10 @@ if (debug) {
|
||||
const trivialFilters = new Set([
|
||||
...skipOnActions,
|
||||
...clearOnActions,
|
||||
...saveOnActions
|
||||
...saveOnActions,
|
||||
]);
|
||||
const trivialOverlapWithFsm = new Set(
|
||||
[...trivialFilters].filter(x => seedFsm.events.has(x))
|
||||
[...trivialFilters].filter((x) => seedFsm.events.has(x))
|
||||
);
|
||||
if (trivialOverlapWithFsm.size > 0) {
|
||||
console.error(
|
||||
|
||||
Reference in New Issue
Block a user