mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-03 03:38:11 +08:00
* Disabled @blueprintjs/classes-constants. #2288. * thuang-eslint-bp-off (#2344) * Disabled @blueprintjs/classes-constants on webpack dev and shared. #2288. * Added TS recommended, suppress lint errors codemod. * Added per-error/warning ignore for tests. * Added per-error/warning ignore for configuration. * Added per-error/warning ignore for src. Removed suppress package. * Minor linting. Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>
94 lines
2.3 KiB
TypeScript
94 lines
2.3 KiB
TypeScript
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
|
const Autosave = (
|
|
state = {
|
|
// cell labels
|
|
obsAnnotationSaveInProgress: false,
|
|
lastSavedAnnoMatrix: null,
|
|
|
|
// gene sets
|
|
genesetSaveInProgress: false,
|
|
lastSavedGenesets: null,
|
|
|
|
// error state
|
|
error: false,
|
|
},
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
|
action: any,
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
|
nextSharedState: any
|
|
) => {
|
|
switch (action.type) {
|
|
case "annoMatrix: init complete": {
|
|
return {
|
|
...state,
|
|
error: false,
|
|
obsAnnotationSaveInProgress: false,
|
|
lastSavedAnnoMatrix: action.annoMatrix,
|
|
};
|
|
}
|
|
|
|
case "writable obs annotations - save started": {
|
|
return {
|
|
...state,
|
|
obsAnnotationSaveInProgress: true,
|
|
};
|
|
}
|
|
|
|
case "writable obs annotations - save error": {
|
|
return {
|
|
...state,
|
|
error: action.message,
|
|
obsAnnotationSaveInProgress: false,
|
|
};
|
|
}
|
|
|
|
case "writable obs annotations - save complete": {
|
|
const { lastSavedAnnoMatrix } = action;
|
|
return {
|
|
...state,
|
|
obsAnnotationSaveInProgress: false,
|
|
error: false,
|
|
lastSavedAnnoMatrix,
|
|
};
|
|
}
|
|
|
|
case "geneset: initial load": {
|
|
return {
|
|
...state,
|
|
genesetSaveInProgress: false,
|
|
lastSavedGenesets: nextSharedState.genesets.genesets,
|
|
};
|
|
}
|
|
|
|
case "autosave: genesets started": {
|
|
return {
|
|
...state,
|
|
genesetSaveInProgress: true,
|
|
};
|
|
}
|
|
|
|
case "autosave: genesets error": {
|
|
return {
|
|
...state,
|
|
genesetSaveInProgress: false,
|
|
error: action.message,
|
|
};
|
|
}
|
|
|
|
case "autosave: genesets complete": {
|
|
const { lastSavedGenesets } = action;
|
|
return {
|
|
...state,
|
|
genesetSaveInProgress: false,
|
|
error: false,
|
|
lastSavedGenesets,
|
|
};
|
|
}
|
|
|
|
default:
|
|
return { ...state };
|
|
}
|
|
};
|
|
|
|
export default Autosave;
|