👺 Fixed usage of context with sockets
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import React, { ReactElement, useCallback } from "react";
|
||||
import React, { ReactElement, useCallback, useContext } from "react";
|
||||
import { isEmpty, isNil, isUndefined } from "lodash";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { fetchComicBookMetadata } from "../actions/fileops.actions";
|
||||
import { WebSocketContext } from "../context/socket/socket.context";
|
||||
import { IFolderData } from "threetwo-ui-typings";
|
||||
import { LazyLog, ScrollFollow } from "react-lazylog";
|
||||
import DynamicList, { createCache } from "react-window-dynamic-list";
|
||||
@@ -29,6 +30,7 @@ interface IProps {
|
||||
*/
|
||||
|
||||
export const Import = (props: IProps): ReactElement => {
|
||||
const socket = useContext(WebSocketContext);
|
||||
const dispatch = useDispatch();
|
||||
const isSocketConnected = useSelector((state: RootState) => {
|
||||
console.log(state);
|
||||
@@ -43,7 +45,7 @@ export const Import = (props: IProps): ReactElement => {
|
||||
const initiateImport = useCallback(() => {
|
||||
if (typeof props.path !== "undefined") {
|
||||
console.log("asdasd");
|
||||
dispatch(fetchComicBookMetadata(props.path));
|
||||
dispatch(fetchComicBookMetadata(props.path, socket));
|
||||
}
|
||||
}, [dispatch]);
|
||||
const cache = createCache();
|
||||
|
||||
Reference in New Issue
Block a user