Commit 3f7dc7ba authored by Jyothish NT's avatar Jyothish NT

replace null with undefined for array

parent 5bae4bbe
Pipeline #112259 passed with stages
in 3 minutes and 48 seconds
......@@ -69,7 +69,7 @@ const ProteinsListItemInfo = (props: Props) => {
setTranscriptWithProteinDomains
] = useState<Transcript | null>(null);
const [xref, setXref] = useState<Xref | null | undefined>();
const [xref, setXref] = useState<Xref | undefined>();
const [proteinSummaryStats, setProteinSummaryStats] = useState<
ProteinStats | null | undefined
......@@ -123,7 +123,7 @@ const ProteinsListItemInfo = (props: Props) => {
fetchXrefId(proteinId, abortController.signal)
.then((response) => {
if (!abortController.signal.aborted) {
response ? setXref(response) : setXref(null);
response ? setXref(response) : setXref(undefined);
setXrefLoadingState(LoadingState.SUCCESS);
}
})
......@@ -138,7 +138,7 @@ const ProteinsListItemInfo = (props: Props) => {
useEffect(() => {
const abortController = new AbortController();
if (xrefLoadingState === LoadingState.SUCCESS && xref === null) {
if (xrefLoadingState === LoadingState.SUCCESS && xref === undefined) {
setSummaryStatsLoadingState(LoadingState.SUCCESS);
return;
}
......
......@@ -53,7 +53,7 @@ export type ProteinStats = {
export const fetchXrefId = async (
proteinId: string,
signal?: AbortSignal
): Promise<Xref | null> => {
): Promise<Xref | undefined> => {
const xrefsUrl = `https://rest.ensembl.org/xrefs/id/${proteinId}?content-type=application/json;external_db=Uniprot/SWISSPROT`;
const xrefsData: XrefsInResponse | undefined = await apiService.fetch(
xrefsUrl,
......@@ -63,7 +63,7 @@ export const fetchXrefId = async (
);
if (!xrefsData) {
return null;
return undefined;
}
return xrefsData[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment