🔧 Fixed bugs with tab changes and state

This commit is contained in:
2021-08-24 21:59:59 -07:00
parent 140f690c77
commit 6994da072d
4 changed files with 15 additions and 6 deletions

View File

@@ -105,7 +105,7 @@ export const getComicBooks = (options) => async (dispatch) => {
});
};
export const importToDB = (payload) => (dispatch) => {
export const importToDB = (payload?: any) => (dispatch) => {
try {
const comicBookMetadata = {
importStatus: {
@@ -115,7 +115,7 @@ export const importToDB = (payload) => (dispatch) => {
score: "0",
},
},
sourcedMetadata: { comicvine: payload },
sourcedMetadata: { comicvine: payload || null },
};
dispatch({
type: IMS_CV_METADATA_IMPORT_CALL_IN_PROGRESS,
@@ -164,7 +164,10 @@ export const fetchComicVineMatches = (searchPayload) => (dispatch) => {
data: {
format: "json",
sort: "name%3Aasc",
query: issueSearchQuery.searchParams.searchTerms.name,
// hack
query: issueSearchQuery.searchParams.searchTerms.name
.replace(/[^a-zA-Z0-9 ]/g, "")
.trim(),
fieldList: "id",
limit: "20",
offset: "0",

View File

@@ -1,8 +1,8 @@
import React, { useCallback, useEffect, useState, ReactElement } from "react";
import React, { useEffect, ReactElement } from "react";
import { getDownloadProgress } from "../actions/airdcpp.actions";
import { useDispatch, useSelector } from "react-redux";
import { RootState, SearchInstance } from "threetwo-ui-typings";
import { isNil, map } from "lodash";
import { RootState } from "threetwo-ui-typings";
import { isNil } from "lodash";
import prettyBytes from "pretty-bytes";
interface IDownloadsPanelProps {

View File

@@ -1,3 +1,4 @@
export const CV_API_CALL_IN_PROGRESS = "CV_SEARCH_IN_PROGRESS";
export const CV_SEARCH_FAILURE = "CV_SEARCH_FAILURE";
export const CV_SEARCH_SUCCESS = "CV_SEARCH_SUCCESS";

View File

@@ -5,6 +5,7 @@ import {
AIRDCPP_RESULT_DOWNLOAD_INITIATED,
AIRDCPP_DOWNLOAD_PROGRESS_TICK,
} from "../constants/action-types";
import { LOCATION_CHANGE } from "connected-react-router";
const initialState = {
isAirDCPPSearchInProgress: false,
@@ -49,6 +50,10 @@ function airdcppReducer(state = initialState, action) {
...state,
downloadProgressData: action.downloadProgressData,
};
case LOCATION_CHANGE:
return {
initialState,
};
default:
return state;