mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-11 02:20:56 +08:00
type catchErrorsWrap callsite
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
action creators related to embeddings choice
|
||||
*/
|
||||
|
||||
import { Dispatch } from "redux";
|
||||
import { AnnoMatrixObsCrossfilter } from "../annoMatrix";
|
||||
import type { RootState } from "../reducers";
|
||||
import { _setEmbeddingSubset } from "../util/stateManager/viewStackHelpers";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
@@ -29,21 +31,15 @@ export async function _switchEmbedding(
|
||||
return [annoMatrix, obsCrossfilter];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
export const layoutChoiceAction = (newLayoutChoice: any) => async (
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
dispatch: any,
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
getState: any
|
||||
) => {
|
||||
export const layoutChoiceAction =
|
||||
(newLayoutChoice: string) =>
|
||||
async (dispatch: Dispatch, getState: () => RootState): Promise<void> => {
|
||||
/*
|
||||
On layout choice, make sure we have selected all on the previous layout, AND the new
|
||||
layout.
|
||||
*/
|
||||
const {
|
||||
annoMatrix: prevAnnoMatrix,
|
||||
obsCrossfilter: prevCrossfilter,
|
||||
} = getState();
|
||||
const { annoMatrix: prevAnnoMatrix, obsCrossfilter: prevCrossfilter } =
|
||||
getState();
|
||||
const [annoMatrix, obsCrossfilter] = await _switchEmbedding(
|
||||
prevAnnoMatrix,
|
||||
prevCrossfilter,
|
||||
@@ -55,4 +51,4 @@ export const layoutChoiceAction = (newLayoutChoice: any) => async (
|
||||
obsCrossfilter,
|
||||
annoMatrix,
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
+20
-16
@@ -1,3 +1,5 @@
|
||||
import { Dispatch } from "redux";
|
||||
|
||||
import * as globals from "../globals";
|
||||
import { AnnoMatrixLoader, AnnoMatrixObsCrossfilter } from "../annoMatrix";
|
||||
import {
|
||||
@@ -11,6 +13,8 @@ import * as annoActions from "./annotation";
|
||||
import * as viewActions from "./viewStack";
|
||||
import * as embActions from "./embedding";
|
||||
import * as genesetActions from "./geneset";
|
||||
import { LayoutColumn, Schema } from "../common/types/entities";
|
||||
import { RootState } from "../reducers";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function setGlobalConfig(config: any) {
|
||||
@@ -36,8 +40,8 @@ async function userColorsFetchAndLoad(dispatch: any) {
|
||||
);
|
||||
}
|
||||
|
||||
async function schemaFetch() {
|
||||
return fetchJson("schema");
|
||||
async function schemaFetch(): Promise<{ schema: Schema }> {
|
||||
return (await fetchJson("schema")) as { schema: Schema };
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
@@ -104,17 +108,17 @@ function prefetchEmbeddings(annoMatrix: any) {
|
||||
/*
|
||||
Application bootstrap
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types --- FIXME: disabled temporarily on migrate to TS.
|
||||
const doInitialDataLoad = () =>
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
catchErrorsWrap(async (dispatch: any) => {
|
||||
const doInitialDataLoad = (): ((
|
||||
dispatch: Dispatch,
|
||||
getState: () => RootState
|
||||
) => void) =>
|
||||
catchErrorsWrap(async (dispatch: Dispatch) => {
|
||||
dispatch({ type: "initial data load start" });
|
||||
|
||||
try {
|
||||
const [config, schema] = await Promise.all([
|
||||
configFetch(dispatch),
|
||||
// @ts-expect-error ts-migrate(2554) FIXME: Expected 0 arguments, but got 1.
|
||||
schemaFetch(dispatch),
|
||||
schemaFetch(),
|
||||
userColorsFetchAndLoad(dispatch),
|
||||
userInfoFetch(dispatch),
|
||||
]);
|
||||
@@ -137,10 +141,9 @@ const doInitialDataLoad = () =>
|
||||
const layoutSchema = schema?.schema?.layout?.obs ?? [];
|
||||
if (
|
||||
defaultEmbedding &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
layoutSchema.some((s: any) => s.name === defaultEmbedding)
|
||||
layoutSchema.some((s: LayoutColumn) => s.name === defaultEmbedding)
|
||||
) {
|
||||
dispatch(embActions.layoutChoiceAction(defaultEmbedding));
|
||||
embActions.layoutChoiceAction(defaultEmbedding);
|
||||
}
|
||||
} catch (error) {
|
||||
dispatch({ type: "initial data load error", error });
|
||||
@@ -188,14 +191,16 @@ const dispatchDiffExpErrors = (dispatch: any, response: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
const requestDifferentialExpression = (
|
||||
const requestDifferentialExpression =
|
||||
(
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
set1: any,
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
set2: any,
|
||||
num_genes = 50
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
) => async (dispatch: any, getState: any) => {
|
||||
) =>
|
||||
async (dispatch: any, getState: any) => {
|
||||
dispatch({ type: "request differential expression started" });
|
||||
try {
|
||||
/*
|
||||
@@ -262,10 +267,9 @@ const requestDifferentialExpression = (
|
||||
error,
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any --- FIXME: disabled temporarily on migrate to TS.
|
||||
function fetchJson(pathAndQuery: any) {
|
||||
function fetchJson(pathAndQuery: string) {
|
||||
return doJsonRequest(
|
||||
`${globals.API.prefix}${globals.API.version}${pathAndQuery}`
|
||||
);
|
||||
|
||||
@@ -26,8 +26,10 @@ export const keepAroundErrorToast = (message: any) =>
|
||||
/*
|
||||
a hard network error
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- - FIXME: disabled temporarily on migrate to TS.
|
||||
export const postNetworkErrorToast = (message: any, key = undefined) =>
|
||||
export const postNetworkErrorToast = (
|
||||
message: string,
|
||||
key: string | undefined = undefined
|
||||
): string =>
|
||||
ToastTopCenter.show(
|
||||
{
|
||||
message,
|
||||
|
||||
Reference in New Issue
Block a user